snowchecked-0.0.1.0: A checksummed variation on Twitter's Snowflake UID generation algorithm
Safe HaskellNone
LanguageHaskell2010

Data.Snowchecked.Internal.Import

Synopsis

Documentation

cutBits :: (Num a, Bits a, Integral bitCount) => a -> bitCount -> a Source #

cutShiftBits :: (Num a, Bits a, Integral cutBitCount, Integral shiftBitCount) => a -> cutBitCount -> shiftBitCount -> a Source #

shiftCutBits :: (Num a, Bits a, Integral cutBitCount, Integral shiftBitCount) => a -> shiftBitCount -> cutBitCount -> a Source #

toInt :: Integral a => a -> Int Source #

class Eq a => Bits a where #

The Bits class defines bitwise operations over integral types.

  • Bits are numbered from 0 with bit 0 being the least significant bit.

Methods

(.&.) :: a -> a -> a infixl 7 #

Bitwise "and"

(.|.) :: a -> a -> a infixl 5 #

Bitwise "or"

shiftL :: a -> Int -> a infixl 8 #

Shift the argument left by the specified number of bits (which must be non-negative). Some instances may throw an Overflow exception if given a negative input.

An instance can define either this and shiftR or the unified shift, depending on which is more convenient for the type in question.

shiftR :: a -> Int -> a infixl 8 #

Shift the first argument right by the specified number of bits. The result is undefined for negative shift amounts and shift amounts greater or equal to the bitSize. Some instances may throw an Overflow exception if given a negative input.

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.

An instance can define either this and shiftL or the unified shift, depending on which is more convenient for the type in question.

Instances

Instances details
Bits Bool

Interpret Bool as 1-bit bit-field

Since: base-4.7.0.0

Instance details

Defined in Data.Bits

Bits Int

Since: base-2.1

Instance details

Defined in Data.Bits

Methods

(.&.) :: Int -> Int -> Int #

(.|.) :: Int -> Int -> Int #

xor :: Int -> Int -> Int #

complement :: Int -> Int #

shift :: Int -> Int -> Int #

rotate :: Int -> Int -> Int #

zeroBits :: Int #

bit :: Int -> Int #

setBit :: Int -> Int -> Int #

clearBit :: Int -> Int -> Int #

complementBit :: Int -> Int -> Int #

testBit :: Int -> Int -> Bool #

bitSizeMaybe :: Int -> Maybe Int #

bitSize :: Int -> Int #

isSigned :: Int -> Bool #

shiftL :: Int -> Int -> Int #

unsafeShiftL :: Int -> Int -> Int #

shiftR :: Int -> Int -> Int #

unsafeShiftR :: Int -> Int -> Int #

rotateL :: Int -> Int -> Int #

rotateR :: Int -> Int -> Int #

popCount :: Int -> Int #

Bits Integer

Since: base-2.1

Instance details

Defined in Data.Bits

Bits Natural

Since: base-4.8.0

Instance details

Defined in Data.Bits

Bits Word

Since: base-2.1

Instance details

Defined in Data.Bits

Bits Word8

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word16

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word32

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word64

Since: base-2.1

Instance details

Defined in GHC.Word

Bits Word256 
Instance details

Defined in Data.WideWord.Word256

Bits a => Bits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Bits a => Bits (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(.&.) :: Const a b -> Const a b -> Const a b #

(.|.) :: Const a b -> Const a b -> Const a b #

xor :: Const a b -> Const a b -> Const a b #

complement :: Const a b -> Const a b #

shift :: Const a b -> Int -> Const a b #

rotate :: Const a b -> Int -> Const a b #

zeroBits :: Const a b #

bit :: Int -> Const a b #

setBit :: Const a b -> Int -> Const a b #

clearBit :: Const a b -> Int -> Const a b #

complementBit :: Const a b -> Int -> Const a b #

testBit :: Const a b -> Int -> Bool #

bitSizeMaybe :: Const a b -> Maybe Int #

bitSize :: Const a b -> Int #

isSigned :: Const a b -> Bool #

shiftL :: Const a b -> Int -> Const a b #

unsafeShiftL :: Const a b -> Int -> Const a b #

shiftR :: Const a b -> Int -> Const a b #

unsafeShiftR :: Const a b -> Int -> Const a b #

rotateL :: Const a b -> Int -> Const a b #

rotateR :: Const a b -> Int -> Const a b #

popCount :: Const a b -> Int #

module Data.Word

module Numeric