Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Aug 23, 2023
1 parent 2d214f7 commit 2cdab28
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions felt/src/lib_lambdaworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,18 @@ impl Integer for Felt252 {
}

fn div_rem(&self, other: &Self) -> (Self, Self) {
let (div, rem) = self.to_biguint().div_mod_floor(&other.to_biguint());
(Self::from(div), Self::from(rem))
let (div, rem) = self
.value
.representative()
.div_rem(&other.value.representative());
(
Self {
value: FieldElement::from(&div),
},
Self {
value: FieldElement::from(&rem),
},
)
}

// NOTE: we overload because the default impl calls div_floor AND mod_floor.
Expand Down

0 comments on commit 2cdab28

Please sign in to comment.