Expand description
Type-level balanced ternary operations. For more information, see the documentation for the
Int
trait.
Re-exports§
pub use types::balanced::*;
Traits§
- Int2P1
- Project the first value in an
IntPair
. - Int2P2
- Project the second value in an
IntPair
. - IntAbs
- Integer absolute value. Used as
Abs<X>
or<X as IntAbs>::Output
. - IntAbs
MinThree Cmp - Three-way integer absolute-value minimum comparison. Takes three integers, and returns a pair, the corresponding argument paired with the integer whose absolute value was smallest.
- IntAdd
- Integer addition. Used as
Add<X, Y>
or<X as IntAdd<Y>>::Output
. - IntCmp
- Integer comparison. Takes five integers - the first two are to be compared. If the result is that the first integer is greater than the second, the fifth integer is returned; if the result is that the two integers are equal, the fourth integer is returned; and if the result is that the first integer is less than the second, the third integer is returned.
- IntCmp2
- Two-way integer comparison, but with the output trait bounds as an
IntPair
instead of anInt
. - IntDiv
- Integer division. Used as
Div<X, Y>
or<X as IntDiv<Y>>::Output
. - IntDiv
Internal - IntLte
Cmp - IntLte
Cmp2 - IntMul
- Integer multiplication. Used as
Mul<X, Y>
or<X as IntMul<Y>>::Output
. - IntNeg
- Integer negation. In balanced ternary, this is just taking every “minus” and “plus” and
switching them. Used as
Neg<X>
or<X as IntNeg>::Output
. - IntPred
- The
Pred
operator subtracts one to an integer. - IntRem
- Integer remainder. Used as
Rem<X, Y>
or<X as IntRem<Y>>::Output
. - IntRev
- Integer reversal. This is probably something you never want to do! However, it’s useful in implementing division, in which we wish to access trits with the most-significant trits first. This reverses all the trits of the integer.
- IntRev
Internal - IntSub
- Integer subtraction. Used as
Sub<X, Y>
or<X as IntSub<Y>>::Output
. - IntSucc
- The
Succ
operator adds one to an integer. - IntTriple
- The
Triple
operator triples an integer, and avoids redundant zeroes (and thus preserves unique representations.) It is equivalent toZero<N>
unlessN
isTerm
, in which caseTriple<Term> = Term
. Its collapsing acts at only one level, which should be sufficient unless multiple levels of redundant zeroes are introduced by user error. - Unique
- The
Unique
operator collapses one level of redundant zeroes in a balanced ternary representation. UsingUnique
every time we might get a redundant zero should get rid of any problems with non-unique representations of zero.