Added LE Triad methods

This commit is contained in:
Shoghi Cervantes 2014-10-30 17:56:58 +01:00
parent fd46c71120
commit 92eb5cb0b8
2 changed files with 23 additions and 1 deletions

View File

@ -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

@ -1 +1 @@
Subproject commit b8b6bec561768816a2f4acff07c2ccceda3d123a
Subproject commit a0e5de5b8e2198d4f7e0329fcf60650252a1e91d