<div><br></div><br><br><div class="gmail_quote">On Thu, May 14, 2009 at 8:46 PM, Don Stewart <span dir="ltr"><<a href="mailto:dons@galois.com">dons@galois.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
leimy2k:<br>
<div><div></div><div class="h5">><br>
><br>
> On Thu, May 14, 2009 at 8:40 PM, Don Stewart <<a href="mailto:dons@galois.com">dons@galois.com</a>> wrote:<br>
><br>
> leimy2k:<br>
> > I actually need little endian encoding... wondering if anyone else hit<br>
> this<br>
> > with Data.Binary. (because I'm working with Bell Lab's 9P protocol which<br>
> does<br>
> > encode things on the network in little-endian order).<br>
> ><br>
> > Anyone got some "tricks" for this?<br>
><br>
> Yes!<br>
> There are big, little and host-endian primitives in the Get/Put monads.<br>
><br>
> <a href="http://hackage.haskell.org/packages/archive/binary/0.5.0.1/doc/html/" target="_blank">http://hackage.haskell.org/packages/archive/binary/0.5.0.1/doc/html/</a><br>
> Data-Binary-Put.html#v%3AputWord16le<br>
><br>
> You can use these to build encoders directly.<br>
><br>
><br>
> Cool... I just have to write my own encoder and decoder now.<br>
><br>
> As a request could we get encodeLe decodeLe for a later version of this<br>
> library? :-) That'd be totally awesome.<br>
<br>
</div></div>Oh, you mean entirely different instances for all the current ones, that<br>
use LE encodings?<br></blockquote><div><br></div><div>Well the library is leaning towards "Network Byte Order" in that it has encode/decode that only encode/decode for Big Endian.</div><div><br></div><div>Us folks who have to do little endian all now have to write our own encoding/decoding :-)</div>
<div><br></div><div>I'm speaking specifically of the encode/decode functions. I have no idea how they're implemented.</div><div><br></div><div>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?)</div>
<div><br></div><div>I'm only half-kidding.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
-- Don<br>
</font></blockquote></div><br>