License | BSD-style |
---|---|

Maintainer | Vincent Hanquez <vincent@snarc.org> |

Stability | stable |

Portability | Good |

Safe Haskell | None |

Language | Haskell2010 |

This module try to keep all the difference between versions of base or other needed packages, so that modules don't need to use CPP

## Synopsis

- unsafeDoIO :: IO a -> a
- popCount :: Bits a => a -> Int
- unsafeShiftL :: Bits a => a -> Int -> a
- unsafeShiftR :: Bits a => a -> Int -> a
- byteSwap64 :: Word64 -> Word64
- byteSwap32 :: Word32 -> Word32
- byteSwap16 :: Word16 -> Word16

# Documentation

unsafeDoIO :: IO a -> a Source #

perform io for hashes that do allocation and ffi. unsafeDupablePerformIO is used when possible as the computation is pure and the output is directly linked to the input. we also do not modify anything after it has been returned to the user.

popCount :: Bits a => a -> Int Source #

Return the number of set bits in the argument. This number is known as the population count or the Hamming weight.

Can be implemented using `popCountDefault`

if `a`

is also an
instance of `Num`

.

*Since: base-4.5.0.0*

unsafeShiftL :: Bits a => a -> Int -> a Source #

unsafeShiftR :: Bits a => a -> Int -> a Source #

Shift the first argument right by the specified number of bits, which must be non-negative and smaller than the number of bits in the type.

Right shifts perform sign extension on signed number types;
i.e. they fill the top bits with 1 if the `x`

is negative
and with 0 otherwise.

Defaults to `shiftR`

unless defined explicitly by an instance.

*Since: base-4.5.0.0*