Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public zeroable on i257 #300

Merged
merged 2 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/math/src/i257.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,17 @@ impl i257Neg of Neg<i257> {
}
}

impl i257Zeroable of Zero<i257> {
pub impl i257Zeroable of Zero<i257> {
fn zero() -> i257 {
I257Impl::new(0, false)
}
fn is_zero(self: @i257) -> bool {
assert(!*self.is_negative, 'no negative zero');
*self.abs == 0
if *self.abs == 0 {
assert(!*self.is_negative, 'no negative zero');
true
} else {
false
}
}
fn is_non_zero(self: @i257) -> bool {
!self.is_zero()
Expand Down
Loading