
5 Oct
2005
5 Oct
'05
12:40 a.m.
On Mon, Oct 03, 2005 at 09:33:11PM +0200, Udo Stenzel 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 all.
Yeah, this is exactly the right approach, just pull out the bytes with a shift and bitwise and, and then send them in one order or the other. there is no need to know the endianess of the architecture the program is running on. John -- John Meacham - ⑆repetae.net⑆john⑈