Skip to content

Commit

Permalink
chore: add missing impls
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Aug 16, 2024
1 parent d32b862 commit a263510
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions noir_stdlib/src/default.nr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ comptime fn derive_default(s: StructDefinition) -> Quoted {

impl Default for Field { fn default() -> Field { 0 } }

impl Default for u1 { fn default() -> u1 { 0 } }
impl Default for u8 { fn default() -> u8 { 0 } }
impl Default for u16 { fn default() -> u16 { 0 } }
impl Default for u32 { fn default() -> u32 { 0 } }
impl Default for u64 { fn default() -> u64 { 0 } }

Expand Down
12 changes: 12 additions & 0 deletions noir_stdlib/src/hash/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,24 @@ impl Hash for Field {
}
}

impl Hash for u1 {
fn hash<H>(self, state: &mut H) where H: Hasher{
H::write(state, self as Field);
}
}

impl Hash for u8 {
fn hash<H>(self, state: &mut H) where H: Hasher{
H::write(state, self as Field);
}
}

impl Hash for u16 {
fn hash<H>(self, state: &mut H) where H: Hasher{
H::write(state, self as Field);
}
}

impl Hash for u32 {
fn hash<H>(self, state: &mut H) where H: Hasher{
H::write(state, self as Field);
Expand Down

0 comments on commit a263510

Please sign in to comment.