instance Show SockAddr

Peter Simons simons at cryp.to
Sun Oct 17 17:57:49 EDT 2004


Tomasz Zielonka writes:

 >> ha2tpl :: HostAddress -> (Int, Int, Int, Int)
 >> ha2tpl n =
 >> let (b1,n1) = (n  .&. 255, n  `shiftR` 8)
 >>     (b2,n2) = (n1 .&. 255, n1 `shiftR` 8)
 >>     (b3,n3) = (n2 .&. 255, n2 `shiftR` 8)
 >>     b4      = n3 .&. 255
 >> in
 >> (fromEnum b1, fromEnum b2, fromEnum b3, fromEnum b4)

 > This won't work on big-endian architectures.

Why not?

Peter



More information about the Libraries mailing list