/** * A fast method to retrieve one row of data from the matrix as a BitArray. * * @param integer $y * @param BitArray $row * @return BitArray */ public function getRow($y, BitArray $row = null) { if ($row === null || $row->getSize() < $this->width) { $row = new BitArray($this->width); } $offset = $y * $this->rowSize; for ($x = 0; $x < $this->rowSize; $x++) { $row->setBulk($x << 5, $this->bits[$offset + $x]); } return $row; }
public function testSetBulk() { $array = new BitArray(64); $array->setBulk(32, 0xffff0000); for ($i = 0; $i < 48; $i++) { $this->assertFalse($array->get($i)); } for ($i = 48; $i < 64; $i++) { $this->assertTrue($array->get($i)); } }