X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=blobdiff_plain;f=src%2FIPv4Address.hs;h=38aec8dd39c5250279a05357db753c8aa2247cf2;hp=4399b05f3ecb1728eca31be6eae5e833a23a3b5b;hb=63d3fd047776a0d5f3406a17f0b51db4ed817b62;hpb=ac5698aeedccb731b4d9494b19efaf62dc70791a diff --git a/src/IPv4Address.hs b/src/IPv4Address.hs index 4399b05..38aec8d 100644 --- a/src/IPv4Address.hs +++ b/src/IPv4Address.hs @@ -192,7 +192,7 @@ instance Enum IPv4Address where -- | Convert an 'Int' @x@ to an 'IPv4Address'. Each octet of @x@ is -- right-shifted by the appropriate number of bits, and the fractional -- part is dropped. - toEnum y = + toEnum signed_x = IPv4Address oct1 oct2 oct3 oct4 where -- Convert the input Int to a Word32 before we proceed. On x86, @@ -201,7 +201,7 @@ instance Enum IPv4Address where -- below doesn't work. The Word32 type is unsigned, so we do the -- math on that and then convert everything back to Int later on -- once we have four much-smaller non-negative numbers. - x = fromIntegral y :: Word32 + x = fromIntegral signed_x :: Word32 -- Chop off the higher octets. x1 = x `mod` 2^32, would be -- redundant.