foundation-0.0.3: Alternative prelude with batteries and no dependencies

Foundation.Bits

Synopsis

# Documentation

(.<<.) :: Bits a => a -> Int -> a Source #

Unsafe Shift Left Operator

(.>>.) :: Bits a => a -> Int -> a Source #

Unsafe Shift Right Operator

Arguments

 :: Int Number to Align -> Int Alignment (power of 2) -> Int

Round up (if needed) to a multiple of alignment closst to m

alignment needs to be a power of two

alignRoundUp 16 8 = 16 alignRoundUp 15 8 = 16

Arguments

 :: Int Number to Align -> Int Alignment (power of 2) -> Int

Round down (if needed) to a multiple of alignment closest to m

alignment needs to be a power of two

alignRoundDown 15 8 = 8
alignRoundDown 8 8  = 8