
Henning has a point. EndianSensitive is arguably the more appropriate notion. What does it mean to 'byteSwap' an 'Integer'? Or a bit vector of length n? -Edward On Thu, May 16, 2013 at 4:59 AM, Henning Thielemann < lemming@henning-thielemann.de> wrote:
On Thu, 16 May 2013, Vincent Hanquez wrote:
On Thu, May 16, 2013 at 10:24:31AM +0200, Henning Thielemann wrote:
If at all, I'd suggest a name without the 'b', since the other functions like 'shift' do not contain a 'b' as well.
apologies if i misunderstood you, but i think that's the whole point. the b is there because it's different than shift. shift works on bits, and bswap works on bytes.
If it would work on bits, I would certainly not call it swap, but 'reverse'. On the MC68000 processor there was an assembly instruction "swap" that swapped upper and lower 16 bits of a 32 bit word.
However if you really only want to swap byte order (and not 16 bit words within 64 bit words and so on), then how about just using a package like 'endian':
http://hackage.haskell.org/**packages/archive/data-endian/** 0.0.1/doc/html/Data-Endian.**htmlhttp://hackage.haskell.org/packages/archive/data-endian/0.0.1/doc/html/Data-...
?
______________________________**_________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/**mailman/listinfo/librarieshttp://www.haskell.org/mailman/listinfo/libraries