proposal/RFC: add bSwap to base in Data.Bits
Henning Thielemann
lemming at henning-thielemann.de
Thu May 16 10:24:31 CEST 2013
On Thu, 16 May 2013, Vincent Hanquez wrote:
> I'm trying to expose some byte swapping (bSwap) capabilities in base, namely
> operation to allow to swap endianness on word{16,32,64}, i.e.:
>
> bswap16 :: Word16 -> Word16
> bswap16 a = (a `shiftR` 8) .|. (a `shiftL` 8)
> ...
If at all, I'd suggest a name without the 'b', since the other functions
like 'shift' do not contain a 'b' as well. You can use qualification if
you want to say that the swap is meant with respect to 'bits'.
More information about the Libraries
mailing list