interface Bits : Type -> Type
The `Bits` interface defines bitwise operations over integral types.
Parameters: a
Methods:
0 Index : Type
(.&.) : a -> a -> a
Bitwise "and"
Fixity Declaration: infixl operator, level 7 (.|.) : a -> a -> a
Bitwise "or"
Fixity Declaration: infixl operator, level 5 xor : a -> a -> a
Bitwise "xor".
Fixity Declaration: infixl operator, level 6 shiftL : a -> Index -> a
Shift the argument left by the specified number of bits.
Fixity Declaration: infixl operator, level 8 shiftR : a -> Index -> a
Shift the argument right by the specified number of bits.
Fixity Declaration: infixl operator, level 8 bit : Index -> a
Sets the `i`-th bit.
zeroBits : a
The value with all bits unset.
complement : a -> a
Returns the bitwise complement of a value.
oneBits : a
The value with all bits set..
complementBit : a -> Index -> a
`complementBit x i` is the same as `xor x (bit i)`.
clearBit : a -> Index -> a
`clearBit x i` is the same as `x .&. complement (bit i)`
testBit : a -> Index -> Bool
Tests, whether the i-th bit is set in the given value.
setBit : a -> Index -> a
Sets the i-th bit of a value.
Implementations:
Bits a => Bits (Identity a)
Bits Bits8
Bits Bits16
Bits Bits32
Bits Bits64
Bits Int
Bits Int8
Bits Int16
Bits Int32
Bits Int64
Bits Integer
Bits a => Bits (Const a b)
0 Index : Bits a => Type
- Totality: total
Visibility: public export (.&.) : Bits a => a -> a -> a
Bitwise "and"
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 7(.|.) : Bits a => a -> a -> a
Bitwise "or"
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 5xor : Bits a => a -> a -> a
Bitwise "xor".
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 6shiftL : {auto __con : Bits a} -> a -> Index -> a
Shift the argument left by the specified number of bits.
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 8shiftR : {auto __con : Bits a} -> a -> Index -> a
Shift the argument right by the specified number of bits.
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 8bit : {auto __con : Bits a} -> Index -> a
Sets the `i`-th bit.
Totality: total
Visibility: public exportzeroBits : Bits a => a
The value with all bits unset.
Totality: total
Visibility: public exportcomplement : Bits a => a -> a
Returns the bitwise complement of a value.
Totality: total
Visibility: public exportoneBits : Bits a => a
The value with all bits set..
Totality: total
Visibility: public exportcomplementBit : {auto __con : Bits a} -> a -> Index -> a
`complementBit x i` is the same as `xor x (bit i)`.
Totality: total
Visibility: public exportclearBit : {auto __con : Bits a} -> a -> Index -> a
`clearBit x i` is the same as `x .&. complement (bit i)`
Totality: total
Visibility: public exporttestBit : {auto __con : Bits a} -> a -> Index -> Bool
Tests, whether the i-th bit is set in the given value.
Totality: total
Visibility: public exportsetBit : {auto __con : Bits a} -> a -> Index -> a
Sets the i-th bit of a value.
Totality: total
Visibility: public exportinterface FiniteBits : Type -> Type
- Parameters: a
Constraints: Bits a
Methods:
bitSize : Nat
Return the number of bits in values of type `t`.
bitsToIndex : Fin bitSize -> Index
Properly correlates `bitSize` and `Index`.
popCount : a -> Nat
Return the number of set bits in the argument. This number is
known as the population count or the Hamming weight.
rotR : a -> Fin bitSize -> a
Rotate the argument right by the specified number of bits.
rotL : a -> Fin bitSize -> a
Rotate the argument left by the specified number of bits.
Implementations:
FiniteBits Bits8
FiniteBits Bits16
FiniteBits Bits32
FiniteBits Bits64
FiniteBits Int
FiniteBits Int8
FiniteBits Int16
FiniteBits Int32
FiniteBits Int64
bitSize : FiniteBits a => Nat
Return the number of bits in values of type `t`.
Totality: total
Visibility: public exportbitsToIndex : {auto __con : FiniteBits a} -> Fin bitSize -> Index
Properly correlates `bitSize` and `Index`.
Totality: total
Visibility: public exportpopCount : FiniteBits a => a -> Nat
Return the number of set bits in the argument. This number is
known as the population count or the Hamming weight.
Totality: total
Visibility: public exportrotR : {auto __con : FiniteBits a} -> a -> Fin bitSize -> a
Rotate the argument right by the specified number of bits.
Totality: total
Visibility: public exportrotL : {auto __con : FiniteBits a} -> a -> Fin bitSize -> a
Rotate the argument left by the specified number of bits.
Totality: total
Visibility: public exportasBitVector : {auto {conArg:6938} : FiniteBits a} -> a -> Vect bitSize Bool
- Totality: total
Visibility: public export asString : FiniteBits a => a -> String
- Totality: total
Visibility: public export