- zext' : machineTy (nextBytes n) ->
machineTy (nextBytes (n +
m))
- zeroUnused : machineTy (nextBytes n) ->
machineTy (nextBytes n)
Zero out the high bits of a truncated bitstring
- zeroExtend : Bits n ->
Bits (n +
m)
Extend the bitstring with zeros, leaving the first n bits unchanged.
- xor' : machineTy n ->
machineTy n ->
machineTy n
Binary xor
- xor : Bits n ->
Bits n ->
Bits n
Binary xor
- urem' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Unsigned remainder (mod)
- urem : Bits n ->
Bits n ->
Bits n
Unsigned remainder (mod)
- unsetBit : Fin n ->
Bits n ->
Bits n
- udiv' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Unsigned integer division
- udiv : Bits n ->
Bits n ->
Bits n
Unsigned integer division
- truncate : Bits (m +
n) ->
Bits n
Truncate the high bits of a bitstring.
- trunc' : machineTy (nextBytes (m +
n)) ->
machineTy (nextBytes n)
- times' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Multiplication
- times : Bits n ->
Bits n ->
Bits n
Multiplication
- srem' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Signed remainder (mod)
- srem : Bits n ->
Bits n ->
Bits n
Signed remainder (mod)
- shiftRightLogical' : machineTy n ->
machineTy n ->
machineTy n
Logical binary right shift
- shiftRightLogical : Bits n ->
Bits n ->
Bits n
Logical binary right shift
- shiftRightArithmetic' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Arithematic binary right shift
- shiftRightArithmetic : Bits n ->
Bits n ->
Bits n
Arithematic binary right shift
- shiftLeft' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
- shiftLeft : Bits n ->
Bits n ->
Bits n
Binary left shift
- sext' : machineTy (nextBytes n) ->
machineTy (nextBytes (n +
m))
- setBit : Fin n ->
Bits n ->
Bits n
- sdiv' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Signed integer division
- sdiv : Bits n ->
Bits n ->
Bits n
Signed integer division
- plus' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Overflowing addition
- plus : Bits n ->
Bits n ->
Bits n
Overflowing addition
- pad8' : Nat ->
(Bits8 ->
Bits8 ->
Bits8) ->
Bits8 ->
Bits8 ->
Bits8
- pad8 : (n : Nat) ->
(Bits8 ->
Bits8 ->
Bits8) ->
Bits8 ->
Bits8 ->
Bits8
Perform a function over Bits8 as if it is carried out on n bits.
(n should be 8 or lower)
- pad64' : Nat ->
(Bits64 ->
Bits64 ->
Bits64) ->
Bits64 ->
Bits64 ->
Bits64
- pad64 : Nat ->
(Bits64 ->
Bits64 ->
Bits64) ->
Bits64 ->
Bits64 ->
Bits64
Perform a function over Bits64 as if it is carried out on n bits.
(n should be 64 or lower)
- pad32' : Nat ->
(Bits32 ->
Bits32 ->
Bits32) ->
Bits32 ->
Bits32 ->
Bits32
- pad32 : Nat ->
(Bits32 ->
Bits32 ->
Bits32) ->
Bits32 ->
Bits32 ->
Bits32
Perform a function over Bits32 as if it is carried out on n bits.
(n should be 32 or lower)
- pad16' : Nat ->
(Bits16 ->
Bits16 ->
Bits16) ->
Bits16 ->
Bits16 ->
Bits16
- pad16 : (n : Nat) ->
(Bits16 ->
Bits16 ->
Bits16) ->
Bits16 ->
Bits16 ->
Bits16
Perform a function over Bits16 as if it is carried out on n bits.
(n should be 16 or lower)
- or' : machineTy n ->
machineTy n ->
machineTy n
Binary or
- or : Bits n ->
Bits n ->
Bits n
Binary or
- nextPow2 : Nat ->
Nat
Finds the next exponent of a power of two.
For example nextPow2 200 = 8
, because 2^8 = 256.
If it is an exact match, it is not rounded up: nextPow2 256 = 8
because 2^8 = 256.
- nextBytes : Nat ->
Nat
Gets the lowest n for which "8 * 2 ^ n" is larger than or equal to the input.
For example, nextBytes 10 = 1
.
Like with nextPow2, the result is not rounded up, so nextBytes 16 = 1
.
- natToBits' : machineTy n ->
Nat ->
machineTy n
Converts a Nat to a machineTy n, with the first argument as an accumulator.
You shouldn't have to call this manually, use natToBits (without ') instead.
- natToBits : Nat ->
machineTy n
Converts a Nat to a machineTy n.
- minus' : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
machineTy (nextBytes n)
Subtraction
- minus : Bits n ->
Bits n ->
Bits n
Subtraction
- machineTy : Nat ->
Type
An index function to access the Bits* types in order.
machineTy 0 = Bits8, machineTy 1 = Bits16, etc.
Any input that would result in getting a type that is larger than supported
will result in the largest supported type instead (currently 64 bits).
- lte : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
Int
- lt : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
Int
- intToBits' : Integer ->
machineTy (nextBytes n)
- intToBits : Integer ->
Bits n
- gte : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
Int
- gt : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
Int
- getPad : Nat ->
machineTy n
- getBit : Fin n ->
Bits n ->
Bool
- eq : machineTy (nextBytes n) ->
machineTy (nextBytes n) ->
Int
- complement' : machineTy (nextBytes n) ->
machineTy (nextBytes n)
- complement : Bits n ->
Bits n
Reverse all the bits in the argument.
- bitsUsed : Nat ->
Nat
Finds the number of bits used by machineTy n
.
For example, bitsUsed 2 = 16
- bitsToStr : Bits n ->
String
- bitsToInt' : machineTy (nextBytes n) ->
Integer
- bitsToInt : Bits n ->
Integer
- bitsToHexStr : Bits n ->
String
- bitAt : (at : Fin n) ->
Bits n
Create a bitstring of length n with the bit given as an argument set to one
and all other bits set to zero.
- and' : machineTy n ->
machineTy n ->
machineTy n
Binary and
- and : Bits n ->
Bits n ->
Bits n
Binary and
- data Bits : Nat ->
Type
A "high-level" wrapper to the types defined by machineTy
.
- MkBits : machineTy (nextBytes n) ->
Bits n
An bits type that has at least n bits available,
up to the maximum supported by machineTy
.