Emulate GMP 5+ operations for GMP 4.x compat
authorHerbert Valerio Riedel <hvr@gnu.org>
Sun, 22 Feb 2015 16:50:07 +0000 (17:50 +0100)
committerHerbert Valerio Riedel <hvr@gnu.org>
Tue, 24 Feb 2015 09:10:22 +0000 (10:10 +0100)
commit5be8ed4da1963ed2d45a65fb61d761c977707cce
treeb58df887cd11e9e4c0dc9eee6982f933264b1a92
parentaead01902e1c41e85b758dbafd15e60d08956374
Emulate GMP 5+ operations for GMP 4.x compat

The following operations are only (officially) available starting with
GMP 5.0:

- `mpn_and_n`
- `mpn_andn_n`
- `mpn_ior_n`
- `mpn_xor_n`

In order to properly support GMP 4.x, we simply emulate those operation
in terms of `mpz_*` operations available in GMP 4.x (unless GMP>=5.x
available, obviously) while incurring some overhead. Ideally, GMP 4.x
environments will reach their EOL in the foreseeable future...

This fixes #10003

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D675
libraries/integer-gmp2/cbits/wrappers.c
libraries/integer-gmp2/src/GHC/Integer/Type.hs