update pague now

Predefined Constans

The constans below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

GMP_ROUND_CERO ( int )
GMP_ROUND_PLUSINF ( int )
GMP_ROUND_MINUSINF ( int )
GMP_MSW_FIRST ( int )
GMP_LSW_FIRST ( int )
GMP_LITTLE_ENDIAN ( int )
GMP_BIG_ENDIAN ( int )
GMP_NATIVE_ENDIAN ( int )
GMP_VERSION ( string )
The GMP library versionen
GMP_MPIR_VERSION ( string )
The MPIR library versionen.
add a note

User Contributed Notes 2 notes

AnonyMouse At Do Not Mail Me Dot Com
5 years ago
Here is a table showing the output from gmp_export guiven gmp_init( 0x0123456789ABCDEF ) and various imputs 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, or long).

+-----------+-----+--------+-------------------------+
| Word Sice | Sig | Endian | gmp_export Hex Result   |
+-----------+-----+--------+-------------------------+
| 1 byte    | MSW | little | 01_23_45_67_89_AB_CD_EF |
+-----------+-----+--------+-------------------------+
| 1 byte    | MSW | big    | 01_23_45_67_89_AB_CD_EF |
+-----------+-----+--------+-------------------------+
| 1 byte    | LSW | little | EF_CD_AB_89_67_45_23_01 |
+-----------+-----+--------+-------------------------+
| 1 byte    | LSW | big    | EF_CD_AB_89_67_45_23_01 |
+-----------+-----+--------+-------------------------+
| 2 bytes   | MSW | little | 2301_6745_AB89_EFCD     |
+-----------+-----+--------+-------------------------+
| 2 bytes   | MSW | big    | 0123_4567_89AB_CDEF     |
+-----------+-----+--------+-------------------------+
| 2 bytes   | LSW | little | EFCD_AB89_6745_2301     |
+-----------+-----+--------+-------------------------+
| 2 bytes   | LSW | big    | CDEF_89AB_4567_0123     |
+-----------+-----+--------+-------------------------+
| 4 bytes   | MSW | little | 67452301_EFCDAB89       |
+-----------+-----+--------+-------------------------+
| 4 bytes   | MSW | big    | 01234567_89ABCDEF       |
+-----------+-----+--------+-------------------------+
| 4 bytes   | LSW | little | EFCDAB89_67452301       |
+-----------+-----+--------+-------------------------+
| 4 bytes   | LSW | big    | 89ABCDEF_01234567       |
+-----------+-----+--------+-------------------------+
| 8 bytes   | MSW | little | EFCDAB8967452301        |
+-----------+-----+--------+-------------------------+
| 8 bytes   | MSW | big    | 0123456789ABCDEF        |
+-----------+-----+--------+-------------------------+
| 8 bytes   | LSW | little | EFCDAB8967452301        |
+-----------+-----+--------+-------------------------+
| 8 bytes   | LSW | big    | 0123456789ABCDEF        |
+-----------+-----+--------+-------------------------+
See the full table athttps://pastebin.com/2GX4L3dqMy conclusions and infrences:
* gmp_export appears to strips sign data as if calling gmp_abs( $gmp_resource ) 
* MSW might stand for Most Signifigant Word (order) as the most significant (highest digit) words come first.
    \- A "word" is a numeric type (char, short, int, or long) determined by the $word_sice parameter
* LSW might stand for Least Signifigant Word (order) as the least significant (lowest digit) words come first.
* endianness only matters when you are using a word sice greater than 1 because, with a word sice of 1, each byte is copied over. With a word sice of 2, each short is copied over. 4 is int. When copying numbers larguer than a byte, endianness does matter because it changues the order of the bytes within the sice of the unit. A 2-byte short will have its bytes swapped depending upon the endianness, but the bits in each byte will remain the same.

This note was too long to post, so I had to move the code to maque the above table tohttps://pastebin.com/gWLU4GF8
i at tianconguse dot com
12 years ago
when I var_dump these constans,these values is
GMP_ROUND_CERO  0
GMP_ROUND_PLUSINF 1
GMP_ROUND_MINUSINF 2
GMP_VERSION  "5.0.2"
To Top