This commit is contained in:
smiley
2015-12-04 04:34:00 +01:00
parent 02b289e366
commit 8671a6936a
14 changed files with 408 additions and 434 deletions
+11 -2
View File
@@ -29,7 +29,7 @@ class BitBuffer{
/**
* @return string
*/
public function __toString(){
/* public function __toString(){
$buffer = '';
for($i = 0; $i < $this->length; $i++){
@@ -38,19 +38,26 @@ class BitBuffer{
return $buffer;
}
*/
/**
* @param $num
* @param $length
*
* @return $this
*/
public function put($num, $length){
for($i = 0; $i < $length; $i++){
$this->putBit((($num >> ($length - $i - 1))&1) === 1);
}
return $this;
}
/**
* @param $bit
*
* @return $this
*/
public function putBit($bit){
$bufIndex = floor($this->length / 8);
@@ -64,6 +71,8 @@ class BitBuffer{
}
$this->length++;
return $this;
}
}