Advertisement
tehKaiN

Untitled

Aug 8th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. function read_u8($hIn) {
  4.     return ord(fRead($hIn, 1));
  5. }
  6.  
  7. function read_u16($hIn) {
  8.     return (
  9.         (read_u8($hIn) <<  0) +
  10.         (read_u8($hIn) <<  8)
  11.     );
  12. }
  13.  
  14. function read_u32($hIn) {
  15.     return (
  16.         (read_u8($hIn) <<  0) +
  17.         (read_u8($hIn) <<  8) +
  18.         (read_u8($hIn) << 16) +
  19.         (read_u8($hIn) << 24)
  20.     );
  21. }
  22.  
  23. function read_str($hIn, $len) {
  24.     return fRead($hIn, $len);
  25. }
  26.  
  27. function read_str_null($hIn) {
  28.     $str = '';
  29.     while(($c = fRead($hIn, 1)) !== "\0") {
  30.         $str .= $c;
  31.     }  
  32. }
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement