-- | 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,
-- 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.