src/Type/Int64.php
public function read(BinaryReader &$br, $length = null)
    {
        if (!$br->canReadBytes(8)) {
            throw new \OutOfBoundsException('Cannot read 64-bit int, it exceeds the boundary of the file');
        }

        $endian = $br->getEndian() == Endian::ENDIAN_BIG ? $this->endianBig : $this->endianLittle;
        $firstSegment = $br->readFromHandle(4);
        $secondSegment = $br->readFromHandle(4);

        $firstHalf = unpack($endian, $firstSegment)[1];
        $secondHalf = unpack($endian, $secondSegment)[1];

        if ($br->getEndian() == Endian::ENDIAN_BIG) {
            $value = bcadd($secondHalf, bcmul($firstHalf, "4294967296"));
        } else {
            $value = bcadd($firstHalf, bcmul($secondHalf, "4294967296"));
        }

        if ($br->getCurrentBit() != 0) {
            $value = $this->bitReader($br, $value);
        }

        return $value;
    }
public function read(BinaryReader &$br, $length = null)
    {
        if (!$br->canReadBytes(8)) {
            throw new \OutOfBoundsException('Cannot read 64-bit int, it exceeds the boundary of the file');
        }

        $endian = $br->getEndian() == Endian::ENDIAN_BIG ? $this->endianBig : $this->endianLittle;
        $firstSegment = $br->readFromHandle(4);
        $secondSegment = $br->readFromHandle(4);

        $firstHalf = unpack($endian, $firstSegment)[1];
        $secondHalf = unpack($endian, $secondSegment)[1];

        if ($br->getEndian() == Endian::ENDIAN_BIG) {
            $value = bcadd($secondHalf, bcmul($firstHalf, "4294967296"));
        } else {
            $value = bcadd($firstHalf, bcmul($secondHalf, "4294967296"));
        }

        if ($br->getCurrentBit() != 0) {
            $value = $this->bitReader($br, $value);
        }

        return $value;
    }
Returns an Unsigned 64-bit Integer

@param  \PhpBinaryReader\BinaryReader $br
@param  null                          $length
@return int
@throws \OutOfBoundsException