Crate const_arithmetic

Source
Expand description

This crate is dedicated to implementing integer arithmetic that can be verified and used during compilation time

Macros§

parse_integer
Turns an integer (u32) into a typed integer object.
typed_assert_eq
This asserts the typed integer provided is the same as the number you provided

Structs§

PhantomData
Zero-sized type used to mark things that “act like” they own a T.
TypedInteger
A struct which generics represents an unique integer from 0 to 2 ** 32 - 1
_0
This denotes the number 0
_1
This denotes the number 1
_2
This denotes the number 2
_3
This denotes the number 3
_4
This denotes the number 4
_5
This denotes the number 5
_6
This denotes the number 6
_7
This denotes the number 7
_8
This denotes the number 8
_9
This denotes the number 9
_A
This denotes the number 10
_B
This denotes the number 11
_C
This denotes the number 12
_D
This denotes the number 13
_E
This denotes the number 14
_F
This denotes the number 15

Traits§

AssertFalse
Asserts that a binary equals to _0
AssertTrue
Asserts that a binary equals to _1
BinAnd
The AND logic gate
BinEq
The NXOR logic gate, or EQUAL operator
BinNor
The NOR logic gate
BinNot
The NOT logic gate
BinOr
The OR logic gate
Binary
Indicates binary types.
Hex
This denotes one single hexadecimal - half a byte
HexAdd
This is an internal implementation of addition of 2 number
HexAdd3
This is an internal implementation of addition of three number
HexAssertEqual
This is an internal implementation of asserted equality on hexadecimal.
HexEqual
This is an internal implementation of equality on hexadecimal. False evaluates to _0 and true evaluates to _1
HexMul
This is an internal implementation of multiplication of two hexadecimal
IsInteger
A trait that denotes whether something is an integer Example
TypedAdd
Denotes integer addition. If this says C7 does not implement HexAssertEq, this means it overflowed.
TypedAssertEqual
A trait that asserts two integers are equal Example
TypedDiv
Returns the Quotient of H/K for H: Div<K, Output: …>
TypedEqual
A trait that returns a binary depending on whether two integers are equal
TypedGeq
A trait that returns a binary depending on whether two integers are greater or equal
TypedGreaterThan
A trait that returns a binary depending on whether a > b
TypedLeq
A trait that returns a binary depending on whether two integers are less or equal
TypedLessThan
A trait that returns a binary depending on whether a < b
TypedMul
A multiplication of 32 bit number and 32 bit number can be stored safely in a 64 bit number. We represent them as lower 32 bits and upper 32 bits
TypedSub
Denotes integer subtraction. If this says C7 does not implement HexAssertEq, this means it underflowed.