proposal/RFC: add bSwap to base in Data.Bits

Vincent Hanquez tab at snarc.org
Thu May 16 11:46:10 CEST 2013


On Thu, May 16, 2013 at 10:59:03AM +0200, Henning Thielemann wrote:
> 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.html

I'm sorry, i completely forgot to put the rationale of this in the original proposal.

http://hackage.haskell.org/trac/ghc/ticket/7902

The point of this exercise is to expose some new primops that swap bytes
efficiently (by generating the proper assembly code), not using an existing
package.

-- 
Vincent



More information about the Libraries mailing list