[Haskell-cafe] Data.Binary and little endian encoding
leimy2k at gmail.com
Thu May 14 23:51:46 EDT 2009
On Thu, May 14, 2009 at 8:46 PM, Don Stewart <dons at galois.com> wrote:
> > On Thu, May 14, 2009 at 8:40 PM, Don Stewart <dons at galois.com> wrote:
> > leimy2k:
> > > I actually need little endian encoding... wondering if anyone else
> > this
> > > with Data.Binary. (because I'm working with Bell Lab's 9P protocol
> > does
> > > encode things on the network in little-endian order).
> > >
> > > Anyone got some "tricks" for this?
> > Yes!
> > There are big, little and host-endian primitives in the Get/Put
> > Data-Binary-Put.html#v%3AputWord16le
> > You can use these to build encoders directly.
> > Cool... I just have to write my own encoder and decoder now.
> > As a request could we get encodeLe decodeLe for a later version of this
> > library? :-) That'd be totally awesome.
> Oh, you mean entirely different instances for all the current ones, that
> use LE encodings?
Well the library is leaning towards "Network Byte Order" in that it has
encode/decode that only encode/decode for Big Endian.
Us folks who have to do little endian all now have to write our own
I'm speaking specifically of the encode/decode functions. I have no idea
how they're implemented.
Are you saying that encode is doing something really simple and the default
encodings for things just happen to be big endian? If so, then I understand
the pain.... but it still means I have to roll my own :-) I guess if one
must choose, big endian kind of makes sense, except that the whole world is
little endian now, except for networks :-) (No one *really* cares about
anything but x86 anyway these days right?)
I'm only half-kidding.
> -- Don
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe