
16 May
2013
16 May
'13
2:59 a.m.
Hi, 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) ... I'ld want to propose to extends Bits to do so generically: class Bits a where ... bSwap : a -> a I'm attaching a patch that do as explained, and add a default implementation for bSwap, so that compatibility is assured for existing instances. -- Vincent