Determines the endianness of the host platform and memoizes
the result to Avro::$endianness.

Based on a similar check perfomed in http://pear.php.net/package/Math_BinaryUtils

@throws AvroException if the endianness cannot be determined.
161691
private static function set_endianness()
  {
    $packed = pack('d', 1);
    switch ($packed)
    {
      case "\77\360\0\0\0\0\0\0":
        self::$endianness = self::BIG_ENDIAN;
        break;
      case "\0\0\0\0\0\0\360\77":
        self::$endianness = self::LITTLE_ENDIAN;
        break;
      default:
        throw new AvroException(
          sprintf('Error determining platform endianness: %s',
                  AvroDebug::hex_string($packed)));
    }
  }
368823
public static function getMemoryLimit()
    {
        $iniVal = ini_get('memory_limit');
        $val = $iniVal !== ''
            ? $iniVal
            : ( version_compare(PHP_VERSION, '5.2.0', '>')
                ? '128M'
                : ( version_compare(PHP_VERSION, '5.2.0', '=')
                    ? '16M'
                    : '8M'
                )
            );
        return $val;
    }
224997
final public function readInt24BE()
    {
        if ($this->isLittleEndian()) {
            return $this->fromInt24(strrev($this->read(3)));
        } else {
            return $this->fromInt24($this->read(3));
        }
    }
304648
def _endian(self) -> str:
        '''
        
        '''
        if (self._encoding == 1 or self._encoding == 2 or self._encoding == 5 or
            self._encoding == 7 or self._encoding == 9 or self._encoding == 11 or
                self._encoding == 12):
            return 'big-endian'
        else:
            return 'little-endian'
751977
final public function readInt32BE()
    {
        if ($this->isLittleEndian()) {
            return $this->fromInt32(strrev($this->read(4)));
        } else {
            return $this->fromInt32($this->read(4));
        }
    }
206256
public function remainingBytes(): int
    {
        /** @var array $stat */
        $stat = \fstat($this->fp);
        /** @var int $pos */
        $pos = \ftell($this->fp);
        return (int) (
            PHP_INT_MAX & (
                (int) $stat['size'] - $pos
            )
        );
    }
188361
public function convertData()
    {
        $ver = $this->estimateVersion();
        if($ver > $this->getVersion()) {
            $this->setVersion($ver);
        }

        for(;;) {
            $bits = $this->createBitStream();

            if($bits < 0)
                return -1;

            $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
            if($ver < 0) {
                throw new Exception('WRONG VERSION');
                return -1;
            } else if($ver > $this->getVersion()) {
                $this->setVersion($ver);
            } else {
                break;
            }
        }

        return 0;
    }
1080570
static ByteOrder byteOrder() {
        if (byteOrder != null)
            return byteOrder;
        long a = unsafe.allocateMemory(8);
        try {
            unsafe.putLong(a, 0x0102030405060708L);
            byte b = unsafe.getByte(a);
            switch (b) {
            case 0x01: byteOrder = ByteOrder.BIG_ENDIAN;     break;
            case 0x08: byteOrder = ByteOrder.LITTLE_ENDIAN;  break;
            default:
                assert false;
            }
        } finally {
            unsafe.freeMemory(a);
        }
        return byteOrder;
    }
1227869
private function getEndianess()
    {
        if (0 === self::$endianess) {
            self::$endianess = $this->fromInt32("\x01\x00\x00\x00") == 1
                             ? self::LITTLE_ENDIAN_ORDER
                             : self::BIG_ENDIAN_ORDER;
        }
        return self::$endianess;
    }
118037
public function readInt16Signed()
    {

        // Read the data into a string
        $string = $this->read(2);

        // For big endian we need to reverse the bytes
        if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) {
            $string = strrev($string);
        }

        $int = unpack('sint', $string);

        unset($string);

        return $int['int'];
    }
277709
def header_big_endian(self):
        
        if not self._ptr:
            raise BfdException("BFD not initialized")

        return _bfd.get_bfd_attribute(
            self._ptr, BfdAttributes.HEADER_BIG_ENDIAN)
810504
def big_endian(self):
        """"""
        if not self._ptr:
            raise BfdException("BFD not initialized")

        return _bfd.get_bfd_attribute(self._ptr, BfdAttributes.IS_BIG_ENDIAN)
663720
public function readDouble($offset = 0)
    {
        $s = $this->read(8, $offset);
        list(, $ret) = unpack("d", self::$isLittleEndian ? self::swapEndian64($s) : $s);
        return $ret;
    }
199749
public function readLong()
    {
        /**
         * Check, that we work in 64-bit mode.
         * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb
         */
        if (PHP_INT_SIZE > 4) {
            $str = substr($this->_data, $this->_position, 8);
            $this->_position += 8;

            return  ord($str[0]) << 56  |
                    ord($str[1]) << 48  |
                    ord($str[2]) << 40  |
                    ord($str[3]) << 32  |
                    ord($str[4]) << 24  |
                    ord($str[5]) << 16  |
                    ord($str[6]) << 8   |
                    ord($str[7]);
        } else {
            return $this->readLong32Bit();
        }
    }
1030416
public function parseFloat()
    {
        try {
            if (Endianness::LITTLE()) {
                return \unpack('f', \strrev(mb_orig_substr($this->buffer, 0, 4)))[1];
            }
            return \unpack('f', $this->buffer)[1]; // @codeCoverageIgnore
        } finally {
            $this->buffer = mb_orig_substr($this->buffer, 4);
        }
    }
237070
public static function swapHalvedEndian64($s)
    {
        return $s[3] . $s[2] . $s[1] . $s[0] . $s[7] . $s[6] . $s[5] . $s[4];
    }
259576
public static function convertBinaryStringToNumber(string $binaryString): int
    {
        return self::convertEndianness((ord($binaryString{1}) << 8) + (ord($binaryString{0}) & 255));
    }