Advertisement
Guest User

Results table from GMP behavior test in PHP

a guest
Jul 20th, 2020
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.62 KB | None | 0 0
  1. Here is a table showing the output from gmp_export given either gmp_init(0x0123456789ABCDEF) or gmp_init(-0x0123456789ABCDEF) and various inputs parameters on a little-endian 64-bit platform. NOTE that the underscores in the table are used to illustrate the separation between "word"s (which are either char/short/int/long).
  2.  
  3. ╔══════╦═══════════╦═════╦════════╦═══════════════════════════════╗
  4. ║ Sign ║ Word Size ║ Sig ║ Endian ║ gmp_export Hex Result ║
  5. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  6. ║ +pos ║ 1 bytes ║ MSW ║ little ║ 01_23_45_67_89_AB_CD_EF ║
  7. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  8. ║ +pos ║ 1 bytes ║ MSW ║ big ║ 01_23_45_67_89_AB_CD_EF ║
  9. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  10. ║ +pos ║ 1 bytes ║ LSW ║ little ║ EF_CD_AB_89_67_45_23_01 ║
  11. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  12. ║ +pos ║ 1 bytes ║ LSW ║ big ║ EF_CD_AB_89_67_45_23_01 ║
  13. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  14. ║ +pos ║ 2 bytes ║ MSW ║ little ║ 2301_6745_AB89_EFCD ║
  15. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  16. ║ +pos ║ 2 bytes ║ MSW ║ big ║ 0123_4567_89AB_CDEF ║
  17. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  18. ║ +pos ║ 2 bytes ║ LSW ║ little ║ EFCD_AB89_6745_2301 ║
  19. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  20. ║ +pos ║ 2 bytes ║ LSW ║ big ║ CDEF_89AB_4567_0123 ║
  21. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  22. ║ +pos ║ 3 bytes ║ MSW ║ little ║ 230100_896745_EFCDAB ║
  23. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  24. ║ +pos ║ 3 bytes ║ MSW ║ big ║ 000123_456789_ABCDEF ║
  25. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  26. ║ +pos ║ 3 bytes ║ LSW ║ little ║ EFCDAB_896745_230100 ║
  27. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  28. ║ +pos ║ 3 bytes ║ LSW ║ big ║ ABCDEF_456789_000123 ║
  29. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  30. ║ +pos ║ 4 bytes ║ MSW ║ little ║ 67452301_EFCDAB89 ║
  31. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  32. ║ +pos ║ 4 bytes ║ MSW ║ big ║ 01234567_89ABCDEF ║
  33. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  34. ║ +pos ║ 4 bytes ║ LSW ║ little ║ EFCDAB89_67452301 ║
  35. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  36. ║ +pos ║ 4 bytes ║ LSW ║ big ║ 89ABCDEF_01234567 ║
  37. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  38. ║ +pos ║ 5 bytes ║ MSW ║ little ║ 4523010000_EFCDAB8967 ║
  39. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  40. ║ +pos ║ 5 bytes ║ MSW ║ big ║ 0000012345_6789ABCDEF ║
  41. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  42. ║ +pos ║ 5 bytes ║ LSW ║ little ║ EFCDAB8967_4523010000 ║
  43. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  44. ║ +pos ║ 5 bytes ║ LSW ║ big ║ 6789ABCDEF_0000012345 ║
  45. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  46. ║ +pos ║ 6 bytes ║ MSW ║ little ║ 230100000000_EFCDAB896745 ║
  47. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  48. ║ +pos ║ 6 bytes ║ MSW ║ big ║ 000000000123_456789ABCDEF ║
  49. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  50. ║ +pos ║ 6 bytes ║ LSW ║ little ║ EFCDAB896745_230100000000 ║
  51. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  52. ║ +pos ║ 6 bytes ║ LSW ║ big ║ 456789ABCDEF_000000000123 ║
  53. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  54. ║ +pos ║ 7 bytes ║ MSW ║ little ║ 01000000000000_EFCDAB89674523 ║
  55. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  56. ║ +pos ║ 7 bytes ║ MSW ║ big ║ 00000000000001_23456789ABCDEF ║
  57. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  58. ║ +pos ║ 7 bytes ║ LSW ║ little ║ EFCDAB89674523_01000000000000 ║
  59. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  60. ║ +pos ║ 7 bytes ║ LSW ║ big ║ 23456789ABCDEF_00000000000001 ║
  61. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  62. ║ +pos ║ 8 bytes ║ MSW ║ little ║ EFCDAB8967452301 ║
  63. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  64. ║ +pos ║ 8 bytes ║ MSW ║ big ║ 0123456789ABCDEF ║
  65. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  66. ║ +pos ║ 8 bytes ║ LSW ║ little ║ EFCDAB8967452301 ║
  67. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  68. ║ +pos ║ 8 bytes ║ LSW ║ big ║ 0123456789ABCDEF ║
  69. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  70. ║ -neg ║ 1 bytes ║ MSW ║ little ║ 01_23_45_67_89_AB_CD_EF ║
  71. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  72. ║ -neg ║ 1 bytes ║ MSW ║ big ║ 01_23_45_67_89_AB_CD_EF ║
  73. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  74. ║ -neg ║ 1 bytes ║ LSW ║ little ║ EF_CD_AB_89_67_45_23_01 ║
  75. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  76. ║ -neg ║ 1 bytes ║ LSW ║ big ║ EF_CD_AB_89_67_45_23_01 ║
  77. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  78. ║ -neg ║ 2 bytes ║ MSW ║ little ║ 2301_6745_AB89_EFCD ║
  79. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  80. ║ -neg ║ 2 bytes ║ MSW ║ big ║ 0123_4567_89AB_CDEF ║
  81. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  82. ║ -neg ║ 2 bytes ║ LSW ║ little ║ EFCD_AB89_6745_2301 ║
  83. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  84. ║ -neg ║ 2 bytes ║ LSW ║ big ║ CDEF_89AB_4567_0123 ║
  85. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  86. ║ -neg ║ 3 bytes ║ MSW ║ little ║ 230100_896745_EFCDAB ║
  87. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  88. ║ -neg ║ 3 bytes ║ MSW ║ big ║ 000123_456789_ABCDEF ║
  89. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  90. ║ -neg ║ 3 bytes ║ LSW ║ little ║ EFCDAB_896745_230100 ║
  91. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  92. ║ -neg ║ 3 bytes ║ LSW ║ big ║ ABCDEF_456789_000123 ║
  93. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  94. ║ -neg ║ 4 bytes ║ MSW ║ little ║ 67452301_EFCDAB89 ║
  95. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  96. ║ -neg ║ 4 bytes ║ MSW ║ big ║ 01234567_89ABCDEF ║
  97. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  98. ║ -neg ║ 4 bytes ║ LSW ║ little ║ EFCDAB89_67452301 ║
  99. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  100. ║ -neg ║ 4 bytes ║ LSW ║ big ║ 89ABCDEF_01234567 ║
  101. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  102. ║ -neg ║ 5 bytes ║ MSW ║ little ║ 4523010000_EFCDAB8967 ║
  103. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  104. ║ -neg ║ 5 bytes ║ MSW ║ big ║ 0000012345_6789ABCDEF ║
  105. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  106. ║ -neg ║ 5 bytes ║ LSW ║ little ║ EFCDAB8967_4523010000 ║
  107. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  108. ║ -neg ║ 5 bytes ║ LSW ║ big ║ 6789ABCDEF_0000012345 ║
  109. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  110. ║ -neg ║ 6 bytes ║ MSW ║ little ║ 230100000000_EFCDAB896745 ║
  111. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  112. ║ -neg ║ 6 bytes ║ MSW ║ big ║ 000000000123_456789ABCDEF ║
  113. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  114. ║ -neg ║ 6 bytes ║ LSW ║ little ║ EFCDAB896745_230100000000 ║
  115. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  116. ║ -neg ║ 6 bytes ║ LSW ║ big ║ 456789ABCDEF_000000000123 ║
  117. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  118. ║ -neg ║ 7 bytes ║ MSW ║ little ║ 01000000000000_EFCDAB89674523 ║
  119. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  120. ║ -neg ║ 7 bytes ║ MSW ║ big ║ 00000000000001_23456789ABCDEF ║
  121. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  122. ║ -neg ║ 7 bytes ║ LSW ║ little ║ EFCDAB89674523_01000000000000 ║
  123. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  124. ║ -neg ║ 7 bytes ║ LSW ║ big ║ 23456789ABCDEF_00000000000001 ║
  125. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  126. ║ -neg ║ 8 bytes ║ MSW ║ little ║ EFCDAB8967452301 ║
  127. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  128. ║ -neg ║ 8 bytes ║ MSW ║ big ║ 0123456789ABCDEF ║
  129. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  130. ║ -neg ║ 8 bytes ║ LSW ║ little ║ EFCDAB8967452301 ║
  131. ╠══════╬═══════════╬═════╬════════╬═══════════════════════════════╣
  132. ║ -neg ║ 8 bytes ║ LSW ║ big ║ 0123456789ABCDEF ║
  133. ╚══════╩═══════════╩═════╩════════╩═══════════════════════════════╝
  134.  
  135. See https://www.php.net/manual/en/gmp.constants.php for the full note.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement