mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Fix issues on 64-bit systems -_- (hate php)
This commit is contained in:
parent
01d465b038
commit
bd1b18d9af
@ -452,9 +452,10 @@ class Binary{
|
||||
}
|
||||
|
||||
public static function readVarInt($stream){
|
||||
$shift = PHP_INT_SIZE === 8 ? 63 : 31;
|
||||
$raw = self::readUnsignedVarInt($stream);
|
||||
$temp = ((($raw << 31) >> 31) ^ $raw) >> 1;
|
||||
return $temp ^ ($raw & (1 << 31));
|
||||
$temp = ((($raw << $shift) >> $shift) ^ $raw) >> 1;
|
||||
return $temp ^ ($raw & (1 << $shift));
|
||||
}
|
||||
|
||||
public static function readUnsignedVarInt($stream){
|
||||
@ -469,7 +470,7 @@ class Binary{
|
||||
}
|
||||
|
||||
public static function writeVarInt($v){
|
||||
return self::writeUnsignedVarInt(($v << 1) ^ ($v >> 31));
|
||||
return self::writeUnsignedVarInt(($v << 1) ^ ($v >> (PHP_INT_SIZE === 8 ? 63 : 31)));
|
||||
}
|
||||
|
||||
public static function writeUnsignedVarInt($v){
|
||||
|
Loading…
x
Reference in New Issue
Block a user