mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-30 20:11:23 +00:00
Made this more idiomatic
This commit is contained in:
@@ -344,14 +344,17 @@ struct Byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Byte {
|
impl Byte {
|
||||||
// TODO: change this name
|
|
||||||
fn unwrap_constant(&self) -> u8 {
|
fn unwrap_constant(&self) -> u8 {
|
||||||
let mut cur = 7;
|
let mut cur = 7;
|
||||||
let mut acc = 0;
|
let mut acc = 0;
|
||||||
|
|
||||||
for bit in &self.bits {
|
for bit in &self.bits {
|
||||||
if let &Bit::Constant(1) = bit {
|
match bit {
|
||||||
acc |= 0b00000001 << cur;
|
&Bit::Constant(1) => {
|
||||||
|
acc |= 0b00000001 << cur;
|
||||||
|
},
|
||||||
|
&Bit::Constant(0) => {},
|
||||||
|
_ => panic!("Tried to unwrap a constant from a non-constant")
|
||||||
}
|
}
|
||||||
cur -= 1;
|
cur -= 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user