foundation-0.0.2: Alternative prelude with batteries and no dependencies

Safe HaskellNone
LanguageHaskell2010

Foundation.Bits

Synopsis

Documentation

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

Unsafe Shift Left Operator

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

Unsafe Shift Right Operator

alignRoundUp Source #

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

alignRoundDown Source #

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