Advertisement
rockdrilla

shifty-nifty games with data and endianness

Jan 13th, 2016
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. ###
  2. ### Little-endian machine:
  3. ###
  4.  
  5. // dump float 1234567.0
  6.  
  7. float: 1234567.000000
  8. int: 4996b438
  9. bytes: 38 b4 96 49
  10. LE-bits: 0 10010011 00101101011010000111000
  11. BE-bits: 0 00011100 01001001100101101011010
  12.  
  13. // dump int 1234567
  14.  
  15. float: 0.000000
  16. int: 0012d687
  17. bytes: 87 d6 12 00
  18. LE-bits: 0 00000000 00100101101011010000111
  19. BE-bits: 1 01000011 00000000000100101101011
  20.  
  21. ###
  22. ### Big-endian machine:
  23. ###
  24.  
  25. // dump float 1234567.0
  26.  
  27. float: 1234567.000000
  28. int: 4996b438
  29. bytes: 49 96 b4 38
  30. LE-bits: 0 00011100 01001001100101101011010
  31. BE-bits: 0 10010011 00101101011010000111000
  32.  
  33. // dump int 1234567
  34.  
  35. float: 0.000000
  36. int: 0012d687
  37. bytes: 00 12 d6 87
  38. LE-bits: 1 01000011 00000000000100101101011
  39. BE-bits: 0 00000000 00100101101011010000111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement