mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Fix issues with writing negative numbers as non-zigzag varints, close #493
This commit is contained in:
parent
87a52a4f35
commit
16972bf9a5
@ -395,6 +395,7 @@ class Binary{
|
||||
*/
|
||||
public static function writeUnsignedVarInt($value){
|
||||
$buf = "";
|
||||
$value &= 0xffffffff;
|
||||
for($i = 0; $i < 5; ++$i){
|
||||
if(($value >> 7) !== 0){
|
||||
$buf .= chr($value | 0x80); //Let chr() take the last byte of this, it's faster than adding another & 0x7f.
|
||||
|
Loading…
x
Reference in New Issue
Block a user