[Haskell-cafe] Endian conversion
tomasz.zielonka at gmail.com
Tue Oct 4 01:31:28 EDT 2005
On 10/3/05, Udo Stenzel <u.stenzel at web.de> wrote:
> Joel Reymont wrote:
> > Are there any endian conversion routines for Haskell? I'm looking to
> > build binary packets on top of NewBinary.Binary but my data is coming
> > in little-endian whereas I'll need to send it out big endian.
> Why don't you pull out 4 bytes and assemble them manually? Three
> shifts, logical ors and fromIntegrals aren't that much of a burden after
Exactly! Network encodings for integers are precisely, mathematically
defined. Surprisingly, it is very difficult to see (it was a revelation for
too). Perhaps the reason is that people get used to the mess in C
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe