mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
Added LE Triad methods
This commit is contained in:
@ -55,6 +55,28 @@ class Binary{
|
||||
return substr(pack("N", $value), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a 3-byte little-endian number
|
||||
*
|
||||
* @param $str
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function readLTriad($str){
|
||||
return unpack("V", $str . "\x00")[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a 3-byte little-endian number
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function writeLTriad($value){
|
||||
return substr(pack("N", $value), 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a coded metadata string
|
||||
* TODO: Replace and move this to entity
|
||||
|
Submodule src/raklib updated: b8b6bec561...a0e5de5b8e
Reference in New Issue
Block a user