-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Why is it used almost everywhere in the code? Its size is 4 times as big as u8, and it's less ergonomic to write collections of chars than binary strings and byte arrays:
['0','-','+',]; // char array: clunky
*b"0-+"; // octet array: terser and efficientAn even better approach is:
/// Balanced Ternary digit ("Trit")
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
#[repr(i8)]
enum BT {
/// Negative
N = -1,
/// Zero
Z = 0,
/// Positive
P = 1,
}Then define a macro that takes a string of BT chars and maps them to an array or Vec of BT variants.
Then, in the future, instead of Vec<BT>, we could copy the code from bitvec (is the license compatible?) and adapt it to ternary, for better optimization
Metadata
Metadata
Assignees
Labels
No labels