Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function read64_int($db) {
- $first = reset(unpack('N', fread($db, 4)));
- $second = reset(unpack('N', fread($db, 4)));
- // Get whether -ve
- $negative = (bool)($first & 128);
- // Strip the sign
- $first &= 127;
- // Add the two
- $result = ($first << 8) + $second;
- // Make it -ve if we need to
- if ($negative)
- $result *= -1;
- // Return
- return $result;
- }
Add Comment
Please, Sign In to add comment