if fixed64 is in fact 32bit value, this is just to improve compatibility with 32bit php, which does not support 64
969367
public function FromBytes($stream, $offset) // ret <= 0 - error
	{
		$moved = 0;
		$vi = 0;
		$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
		if ($parsed <= 0)
			return $parsed;

		//echo "vi $vi\n";
		$this->wt = ($vi & 0x07);
		$this->fn = ($vi >> 3);
		//echo "field wt " . $this->wt . " fn " . $this->fn . "\n";

		switch ($this->wt)
		{
			case ProtoBuf_Field::ProtoBuf_WireType_Varint: // TODO: in case we need this information, create get function
				$this->data = 0;
				$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $this->data);
				break;
			case ProtoBuf_Field::ProtoBuf_WireType_64bit:
				$this->data = substr($stream, $offset + $moved, 8);
				$high4 = ProtoBuf_Bytes2Fixed(substr($this->data, 4), 4);
				if ($high4 == 0)
				{
					$this->fixed64_is_32bit = true;
					$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
				}
				else
				{
					$this->fixed64_is_32bit = false;
					$this->data = ProtoBuf_Bytes2Fixed($this->data, 8);
				}
				$moved += 8;
				break;
			case ProtoBuf_Field::ProtoBuf_WireType_LengthDelimited:
				$moved += $parsed = ProtoBuf_Bytes2Varint($stream, $offset + $moved, $vi);
				if ($parsed <= 0)
					return $parsed;
				$this->data = substr($stream, $offset + $moved, $vi);
				$moved += $vi;
				break;
			/*case ProtoBuf_Field::ProtoBuf_WireType_StartGroup: // TODO: in case we need this information, create get function
				break;
			case ProtoBuf_Field::ProtoBuf_WireType_EndGroup: // TODO: in case we need this information, create get function
				break;*/
			case ProtoBuf_Field::ProtoBuf_WireType_32bit:
				$this->data = substr($stream, $offset + $moved, 4);
				$this->data = ProtoBuf_Bytes2Fixed($this->data, 4);
				$moved += 4;
				break;
			default:
				die("[lib_protobuf.inc] Unrecognized protobuf wire type '" . $this->wt . "'\n");
				break;
		}

		return $moved;
	}
1249845
function b64utob64(s) {
    if (s.length % 4 == 2) s = s + "==";
    else if (s.length % 4 == 3) s = s + "=";
    s = s.replace(/-/g, "+");
    s = s.replace(/_/g, "/");
    return s;
}
592076
private function fixUtf8Encoding($value) {
        $encoding = mb_detect_encoding($value, null, true);
        if ($encoding!='ASCII' && $encoding!='UTF-8')
            $value = utf8_encode($value);
        return $value;
    }
57613
void writeLong(long value) throws IOException {
        if (value < MIN_FIX_INT) {
            // large negative
            if (value >= Byte.MIN_VALUE) {
                output.writeByte(SINT_8);
                output.writeByte((byte) value);
            } else if (value >= Short.MIN_VALUE) {
                output.writeByte(SINT_16);
                output.writeShort((short) value);
            } else if (value >= Integer.MIN_VALUE) {
                output.writeByte(SINT_32);
                output.writeInt((int) value);
            } else {
                output.writeByte(SINT_64);
                output.writeLong(value);
            }
        } else if (value < MAX_FIX_INT) {
            // in range -64 to 127
            output.writeByte((byte) value);
        } else {
            // large positive
            if (value < 0xFF) {
                output.writeByte(UINT_8);
                output.writeByte((byte) value);
            } else if (value < 0xFFFF) {
                output.writeByte(UINT_16);
                output.writeShort((short) value);
            } else if (value < 0xFFFFFFFFL) {
                output.writeByte(UINT_32);
                output.writeInt((int) value);
            } else {
                output.writeByte(UINT_64);
                output.writeLong(value);
            }
        }
    }
925364
private function checkMemoryLimit()
    {
        if (function_exists('ini_get')) {
            /**
             * Note that this calculation is incorrect for memory limits that
             * exceed the value range of the underlying platform's native
             * integer.
             * In practice, we will get away with it, because it doesn't make
             * sense to configure PHP's memory limit to half the addressable
             * RAM (2 GB on a typical 32-bit system).
             */
            $memoryInBytes = function ($value) {
                    $unit = strtolower(substr($value, -1, 1));
                    $value = (int) $value;
                    switch ($unit) {
                        case 'g':
                            $value *= 1024 * 1024 * 1024;
                            break;
                        case 'm':
                            $value *= 1024 * 1024;
                            break;
                        case 'k':
                            $value *= 1024;
                            break;
                    }

                    return $value;
                };

            $memoryLimit = trim(ini_get('memory_limit'));
            // Increase memory_limit if it is lower than 512M
            if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
                trigger_error("Configured memory limit ($memoryLimit) is lower " .
                              "than 512M; composer-wrapper may not work " .
                              "correctly. Consider increasing PHP's " .
                              "memory_limit to at least 512M.",
                              E_USER_NOTICE);
            }
        }

    }
322028
def unpack_fixed16(src):
    """"""
    dec_part = unpack_ui16(src)
    int_part = unpack_ui16(src)
    return int_part + dec_part / 65536
665543
public static boolean isBase64(byte octet) {
        return octet == PAD || (octet >= 0 && octet < DECODE_TABLE.length && DECODE_TABLE[octet] != -1);
    }
1158092
private static final int base64ValueOf (final char c) {
        if ('A' <= c && c <= 'Z') return c - 'A';
        if ('a' <= c && c <= 'z') return c - 'a' + 26;
        if ('0' <= c && c <= '9') return c - '0' + 52;
        if (c == '+') return 62;
        if (c == '/') return 63;
        throw new NumberFormatException();
    }
1105565
private static int appendLong(byte[] data, int offset, long value) {
        offset = appendByte(data, offset, value >>> 56);
        offset = appendByte(data, offset, value >>> 48);
        offset = appendByte(data, offset, value >>> 40);
        offset = appendByte(data, offset, value >>> 32);
        offset = appendInt(data, offset, value);
        return offset;
    }
1273111
private function parseUnsignedInt64()
    {
        try {
            $result = \unpack('J', $this->buffer)[1];
            if ($result < 0) {
                return sprintf('%u', $result);
            }
            return $result;
        } finally {
            $this->buffer = mb_orig_substr($this->buffer, 8);
        }
    }
613757
function int64_to_bytes(num) {
        var retval = []
        for (var i = 0; i < 8; i++) {
            retval.push(num & 0xFF)
            num = num >>> 8
        }
        return retval
    }
815117
public function writeUInt64(int $value): self
    {
        $this->bytes .= Writer::bit64($value);

        return $this;
    }
757796
public function getSteamID64() {
		if (PHP_INT_SIZE == 4) {
			$ret = new Math_BigInteger();
			$ret = $ret->add((new Math_BigInteger($this->universe))->bitwise_leftShift(56));
			$ret = $ret->add((new Math_BigInteger($this->type))->bitwise_leftShift(52));
			$ret = $ret->add((new Math_BigInteger($this->instance))->bitwise_leftShift(32));
			$ret = $ret->add(new Math_BigInteger($this->accountid));
			return $ret->toString();
		}
		return (string) (($this->universe << 56) | ($this->type << 52) | ($this->instance << 32) | ($this->accountid));
	}
285369
private static boolean containsBase64Byte(byte[] arrayOctet) {
        for (int i = 0; i < arrayOctet.length; i++) {
            if (isBase64(arrayOctet[i])) {
                return true;
            }
        }
        return false;
    }
463431
public final void mFIXED64() throws RecognitionException {
        try {
            int _type = FIXED64;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:183:5: ( 'fixed64' )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:183:9: 'fixed64'
            {
            match("fixed64"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
528744
function divmodInt64(src) {
  const hi32 = Math.floor(src / V2E32);
  const lo32 = src - (hi32 * V2E32);
  // assert.equal(roundedInt64(hi32, lo32), src);
  // assert(0 <= lo32);
  return {hi32, lo32};
}
722617
public static void writeInt64(final long value, final byte[] buffer, int offset)
    {
        buffer[offset++] = (byte) (value >>> 56);
        buffer[offset++] = (byte) (value >>> 48);
        buffer[offset++] = (byte) (value >>> 40);
        buffer[offset++] = (byte) (value >>> 32);
        buffer[offset++] = (byte) (value >>> 24);
        buffer[offset++] = (byte) (value >>> 16);
        buffer[offset++] = (byte) (value >>> 8);
        buffer[offset] = (byte) (value >>> 0);
    }