Use 32-bit GMP size limit on unknown architectures

There doesn't seem to be a general-purpose way to determine architecture
word sizes from CPP as invoked by GHC, so we now fall back on the 32-bit
GMP size limit for unknown architectures. This is always safe, and can
be amended to allow larger words on other architectures as needed.

Closes #542.
This commit is contained in:
Aaron Tomb 2018-09-12 11:28:24 -07:00
parent 0d0eb2cbc3
commit 3caa3a8e82

View File

@ -22,5 +22,9 @@ maxBigIntWidth = 2^(32 :: Integer) - 0x1
#elif x86_64_HOST_ARCH
maxBigIntWidth = 2^(37 :: Integer) - 0x100
#else
#error unknown max width for gmp on this architecture
-- Because GHC doesn't seem to define a CPP macro that will portably
-- tell us the bit width we're compiling for, fall back on a safe choice
-- for other architectures. If we care about large words on another
-- architecture, we can add a special case for it.
maxBigIntWidth = 2^(32 :: Integer) - 0x1
#endif