memory-0.15.0: memory and related abstraction stuff
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilitystable
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Data.Memory.Internal.Compat

Description

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

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 #

Shift the argument left by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the bitSize.

Defaults to shiftL unless defined explicitly by an instance.

Since: base-4.5.0.0

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

byteSwap64 :: Word64 -> Word64 Source #

Reverse order of bytes in Word64.

Since: base-4.7.0.0

byteSwap32 :: Word32 -> Word32 Source #

Reverse order of bytes in Word32.

Since: base-4.7.0.0

byteSwap16 :: Word16 -> Word16 Source #

Reverse order of bytes in Word16.

Since: base-4.7.0.0