Skip to content

Commit

Permalink
changed modulo to use divmod directly to optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
sharyashuvgiathaifa authored and calccrypto committed Jan 7, 2025
1 parent 092e4c8 commit 432fa37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion uint256_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ uint256_t uint256_t::operator%(const uint128_t & rhs) const{
}

uint256_t uint256_t::operator%(const uint256_t & rhs) const{
return *this - (rhs * (*this / rhs));
return divmod(*this, rhs).second;
}

uint256_t & uint256_t::operator%=(const uint128_t & rhs){
Expand Down

0 comments on commit 432fa37

Please sign in to comment.