kazu-yamamoto / iproute

IP Routing Table in Haskell
http://www.mew.org/~kazu/proj/iproute/
BSD 3-Clause "New" or "Revised" License
47 stars 28 forks source link

Extend `intToMask` to allow creating hostmasks #28

Closed DanielG closed 9 years ago

DanielG commented 9 years ago

intToMask only allows creating masks starting from MSB, since the IP types don't have a bits instance it's not possible to create a hostmask (starting from LSB) from such a mask.

See the doctests in the patch for examples.

Note: I only tested this on x86. I'm assuming the internal types always have host byte order if that's not true big endian platforms would probably break.

kazu-yamamoto commented 9 years ago

Merged. Thanks!