Advertisement
Guest User

Untitled

a guest
Sep 25th, 2011
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. function endian_swap_ushort( &$x )
  2. {
  3.     $x = ( $x >> 8 ) |
  4.             ( $x << 8 );
  5. }
  6.  
  7. function endian_swap_uint( &$x )
  8. {
  9.     $x = ( $x>>24 ) |
  10.             ( ( $x << 8 ) & 0x00FF0000 ) |
  11.             ( ( $x >> 8 ) & 0x0000FF00 ) |
  12.             ( $x << 24 );
  13. }
  14.  
  15. function endian_swap_ulong( &$x )
  16. {
  17.     $x = ( $x >> 56 ) |
  18.             ( ( $x << 40 ) & 0x00FF000000000000 ) |
  19.             ( ( $x << 24 ) & 0x0000FF0000000000 ) |
  20.             ( ( $x << 8 )  & 0x000000FF00000000 ) |
  21.             ( ( $x >> 8 )  & 0x00000000FF000000 ) |
  22.             ( ( $x >> 24 ) & 0x0000000000FF0000 ) |
  23.             ( ( $x >> 40 ) & 0x000000000000FF00 ) |
  24.             ( $x << 56 );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement