Skip to content

Commit

Permalink
chore: replace AztecU128 with U128 (#3951)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored and AztecBot committed Jan 15, 2024
1 parent 2d92108 commit 001b8e0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions noir_stdlib/src/uint128.nr
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ impl U128 {
}
}

pub fn to_be_bytes(self: Self) -> [u8; 16] {
let lo = self.lo.to_be_bytes(8);
let hi = self.hi.to_be_bytes(8);
let mut bytes = [0;16];
for i in 0..8 {
bytes[i] = hi[i];
bytes[i+8] = lo[i];
}
bytes
}

pub fn to_le_bytes(self: Self) -> [u8; 16] {
let lo = self.lo.to_le_bytes(8);
let hi = self.hi.to_le_bytes(8);
Expand Down

0 comments on commit 001b8e0

Please sign in to comment.