function testLongBig() { $o = PelConvert::BIG_ENDIAN; $this->assertEqual(PelConvert::bytesToLong($this->bytes, 0, $o), 0x0); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 1, $o), 0x1); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 2, $o), 0x123); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 3, $o), 0x12345); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 4, $o), 0x1234567); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 5, $o), 0x23456789); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 6, $o), 0x456789ab); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 7, $o), 0x6789abcd); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 8, $o), 0x89abcdef); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 9, $o), 0xabcdefff); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 10, $o), 0xcdefffff); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 11, $o), 0xefffffff); $this->assertEqual(PelConvert::bytesToLong($this->bytes, 12, $o), 0xffffffff); }
/** * Return an unsigned long read from the data. * * @param * int the offset into the data. An offset of zero will * return the first long available in the current allowed window. * The last valid offset is equal to {@link getSize()}-4. Invalid * offsets will result in a {@link PelDataWindowOffsetException} * being thrown. * * @return int the unsigned long found at offset. */ public function getLong($o = 0) { /* * Validate the offset+3 to see if we can safely get four bytes * --- this throws an exception if offset is out of range. */ $this->validateOffset($o); $this->validateOffset($o + 3); /* Translate the offset into an offset into the data. */ $o += $this->start; /* Return an unsigned long. */ return PelConvert::bytesToLong($this->data, $o, $this->order); }