pub fn decode_bcd(c: char) -> u8Expand description
Translate a binary representation to u8 using the bcd encoding
bcd: binary coded decimal
| Tens | Ones |
|---|---|
| n/a | 8 |
| 64 | 4 |
| 32 | 2 |
| 16 | 1 |
use bbd_lib::*;
assert_eq!(
"\
⠀⢀⠠⢠⠐⢐⠰⢰⠈⢈⡀⣀⡠⣠⡐⣐⡰⣰⡈⣈⠄⢄⠤⢤⠔⢔⠴⢴⠌⢌⡄⣄⡤⣤⡔⣔⡴⣴⡌⣌⠂⢂⠢⢢⠒⢒⠲⢲⠊⢊\
⡂⣂⡢⣢⡒⣒⡲⣲⡊⣊⠆⢆⠦⢦⠖⢖⠶⢶⠎⢎⡆⣆⡦⣦⡖⣖⡶⣶⡎⣎⠁⢁⠡⢡⠑⢑⠱⢱⠉⢉⡁⣁⡡⣡⡑⣑⡱⣱⡉⣉\
".chars().map(|x| decode_bcd(x)).collect::<Vec<u8>>(),
(0..=99).collect::<Vec<u8>>(),
);