Skip to content

Commit

Permalink
dev: implement Zero for u384
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Sep 2, 2024
1 parent e2ff77c commit 9da9880
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions corelib/src/circuit.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,17 @@ impl Felt252IntoU384 of Into<felt252, u384> {
conversions::from_u256(self.into())
}
}

impl U384Zero of crate::num::traits::Zero<u384> {
fn zero() -> u384 {
crate::circuit::u384 { limb0: 0, limb1: 0, limb2: 0, limb3: 0 }
}

fn is_zero(self: @u384) -> bool {
*self == Self::zero()
}

fn is_non_zero(self: @u384) -> bool {
!self.is_zero()
}
}

0 comments on commit 9da9880

Please sign in to comment.