mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Added GMP base
This commit is contained in:
parent
b3db08a370
commit
20e6d19d85
@ -526,10 +526,10 @@ class Utils extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function readLong($str){
|
public static function readLong($str){
|
||||||
$n = gmp_init(Utils::strToHex($str));
|
$n = gmp_init(Utils::strToHex($str), 16);
|
||||||
if(gmp_testbit($n, 63)){
|
if(gmp_testbit($n, "63")){
|
||||||
$n = gmp_xor($n, "0xffffffffffffffff"); //flip the bits
|
$n = gmp_xor($n, "0xffffffffffffffff"); //flip the bits
|
||||||
$n = gmp_neg(gmp_add($n, 1)); // add one and negate
|
$n = gmp_neg(gmp_add($n, "1")); // add one and negate
|
||||||
}
|
}
|
||||||
return gmp_strval($n);
|
return gmp_strval($n);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user