]> gitweb.michael.orlitzky.com - hath.git/commit
src/IPv4Address.hs: fix the inverse toEnum/fromEnum property on x86.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 4 Mar 2019 02:26:31 +0000 (21:26 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 4 Mar 2019 02:26:31 +0000 (21:26 -0500)
commitac5698aeedccb731b4d9494b19efaf62dc70791a
tree05e14f2487d1678d413bd339be2f65966f56a972
parent71f626d17e4308e00a894d088626bb72322dedec
src/IPv4Address.hs: fix the inverse toEnum/fromEnum property on x86.

The second half of the fix in the previous commit turned out to be in
the test itself. The "smallness test" that I was using was to compare
against the number (2^32 - 1), which works great if said number is
interpreted as a 64-bit integer. However on x86 systems, it's a 32-bit
integer, namely negative one! Oops.

This commit splits that test into two; one that tests randomly-generated
Int32s, and one that tests randomly-generated Int64s. Hopefully this
ensures that no similar problems with the machine Int type creep in.
src/IPv4Address.hs