From: Michael Orlitzky Date: Sun, 9 May 2010 18:11:36 +0000 (-0400) Subject: Fixed the IPv4Address apply_mask function; the bit order was backwards. X-Git-Tag: 0.0.1~57 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=e7c180726c794ec12c43496cd7d60a8ea8d5a47f;p=hath.git Fixed the IPv4Address apply_mask function; the bit order was backwards. --- diff --git a/src/Maskable.hs b/src/Maskable.hs index 40cd9cc..051bb65 100644 --- a/src/Maskable.hs +++ b/src/Maskable.hs @@ -40,37 +40,37 @@ instance Maskable IPv4Address where apply_mask _ Maskbits.None = IPv4Address.None apply_mask addr mask | mask == ThirtyTwo = ipv4address_from_octets oct1 oct2 oct3 oct4 - | mask == ThirtyOne = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 One) - | mask == Thirty = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Two) - | mask == TwentyNine = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Three) + | mask == ThirtyOne = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Seven) + | mask == Thirty = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Six) + | mask == TwentyNine = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Five) | mask == TwentyEight = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Four) - | mask == TwentySeven = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Five) - | mask == TwentySix = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Six) - | mask == TwentyFive = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Seven) + | mask == TwentySeven = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Three) + | mask == TwentySix = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 Two) + | mask == TwentyFive = ipv4address_from_octets oct1 oct2 oct3 (apply_mask oct4 One) | mask == TwentyFour = ipv4address_from_octets oct1 oct2 oct3 (min_octet) - | mask == TwentyThree = ipv4address_from_octets oct1 oct2 (apply_mask oct3 One) (min_octet) - | mask == TwentyTwo = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Two) (min_octet) - | mask == TwentyOne = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Three) (min_octet) + | mask == TwentyThree = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Seven) (min_octet) + | mask == TwentyTwo = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Six) (min_octet) + | mask == TwentyOne = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Five) (min_octet) | mask == Twenty = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Four) (min_octet) - | mask == Nineteen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Five) (min_octet) - | mask == Eighteen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Six) (min_octet) - | mask == Seventeen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Seven) (min_octet) + | mask == Nineteen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Three) (min_octet) + | mask == Eighteen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 Two) (min_octet) + | mask == Seventeen = ipv4address_from_octets oct1 oct2 (apply_mask oct3 One) (min_octet) | mask == Sixteen = ipv4address_from_octets oct1 oct2 (min_octet) (min_octet) - | mask == Fifteen = ipv4address_from_octets oct1 (apply_mask oct2 One) (min_octet) (min_octet) - | mask == Fourteen = ipv4address_from_octets oct1 (apply_mask oct2 Two) (min_octet) (min_octet) - | mask == Thirteen = ipv4address_from_octets oct1 (apply_mask oct2 Three) (min_octet) (min_octet) + | mask == Fifteen = ipv4address_from_octets oct1 (apply_mask oct2 Seven) (min_octet) (min_octet) + | mask == Fourteen = ipv4address_from_octets oct1 (apply_mask oct2 Six) (min_octet) (min_octet) + | mask == Thirteen = ipv4address_from_octets oct1 (apply_mask oct2 Five) (min_octet) (min_octet) | mask == Twelve = ipv4address_from_octets oct1 (apply_mask oct2 Four) (min_octet) (min_octet) - | mask == Eleven = ipv4address_from_octets oct1 (apply_mask oct2 Five) (min_octet) (min_octet) - | mask == Ten = ipv4address_from_octets oct1 (apply_mask oct2 Six) (min_octet) (min_octet) - | mask == Nine = ipv4address_from_octets oct1 (apply_mask oct2 Seven) (min_octet) (min_octet) + | mask == Eleven = ipv4address_from_octets oct1 (apply_mask oct2 Three) (min_octet) (min_octet) + | mask == Ten = ipv4address_from_octets oct1 (apply_mask oct2 Two) (min_octet) (min_octet) + | mask == Nine = ipv4address_from_octets oct1 (apply_mask oct2 One) (min_octet) (min_octet) | mask == Eight = ipv4address_from_octets oct1 (min_octet) (min_octet) (min_octet) - | mask == Seven = ipv4address_from_octets (apply_mask oct1 One) (min_octet) (min_octet) (min_octet) - | mask == Six = ipv4address_from_octets (apply_mask oct1 Two) (min_octet) (min_octet) (min_octet) - | mask == Five = ipv4address_from_octets (apply_mask oct1 Three) (min_octet) (min_octet) (min_octet) + | mask == Seven = ipv4address_from_octets (apply_mask oct1 Seven) (min_octet) (min_octet) (min_octet) + | mask == Six = ipv4address_from_octets (apply_mask oct1 Six) (min_octet) (min_octet) (min_octet) + | mask == Five = ipv4address_from_octets (apply_mask oct1 Five) (min_octet) (min_octet) (min_octet) | mask == Four = ipv4address_from_octets (apply_mask oct1 Four) (min_octet) (min_octet) (min_octet) - | mask == Three = ipv4address_from_octets (apply_mask oct1 Five) (min_octet) (min_octet) (min_octet) - | mask == Two = ipv4address_from_octets (apply_mask oct1 Six) (min_octet) (min_octet) (min_octet) - | mask == One = ipv4address_from_octets (apply_mask oct1 Seven) (min_octet) (min_octet) (min_octet) + | mask == Three = ipv4address_from_octets (apply_mask oct1 Three) (min_octet) (min_octet) (min_octet) + | mask == Two = ipv4address_from_octets (apply_mask oct1 Two) (min_octet) (min_octet) (min_octet) + | mask == One = ipv4address_from_octets (apply_mask oct1 One) (min_octet) (min_octet) (min_octet) | mask == Zero = ipv4address_from_octets (min_octet) (min_octet) (min_octet) (min_octet) | otherwise = IPv4Address.None where