Next: , Previous: , Up: MPIR Basics   [Index]


3.3 MPIR on Windows x64

Although Windows x64 is a 64-bit operating system, Microsoft has decided to make long integers 32-bits, which is inconsistent when compared with almost all other 64-bit operating systems. This has caused many subtle bugs when open source code is ported to Windows x64 because many developers reasonably expect to find that long integers on a 64-bit operating system will be 64 bits long.

MPIR contains functions with suffixes of _ui and _si that are used to input unsigned and signed integers into and convert them for use with MPIR’s multiple precision integers (mpz types). For example, the following functions set an mpz_t integer from unsigned and signed long integers respectively.

Function: void mpz_set_ui (mpz_t, unsigned long int)
Function: void mpz_set_si (mpz_t, signed long int)

Also, the following functions obtain unsigned and signed long int values from an MPIR multiple precision integer (mpz_t).

Function: unsigned long int mpz_get_ui (mpz_t)
Function: signed long int mpz_get_si (mpz_t)

To bring MPIR on Windows x64 into line with other 64-bit operating systems two new types have been introduced throughout MPIR:


The above prototypes in MPIR 2.6.0 are changed to:

Function: void mpz_set_ui (mpz_t, mpir_ui)
Function: void mpz_set_si (mpz_t, mpir_si)
Function: mpir_ui mpz_get_ui (mpz_t)
Function: mpir_si mpz_get_si (mpz_t)

These changes are applied to all MPIR functions with _ui and _si suffixes.


Next: , Previous: , Up: MPIR Basics   [Index]