Skip to content

Commit

Permalink
Merge pull request #51 from chrisZgh/master
Browse files Browse the repository at this point in the history
Corrected undefined behavior in overflow of int
  • Loading branch information
mkskeller authored Dec 21, 2019
2 parents dad23a6 + 9d47211 commit d28a83f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Math/Zp_Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void Zp_Data::init(const bigint& p,bool mont)
#endif

pr=p;
mask=(1LL<<((mpz_sizeinbase(pr.get_mpz_t(),2)-1)%(8*sizeof(mp_limb_t))))-1;
mask=static_cast<mp_limb_t>(1ULL<<((mpz_sizeinbase(pr.get_mpz_t(),2)-1)%(8*sizeof(mp_limb_t))))-1);
pr_byte_length = numBytes(pr);
pr_bit_length = numBits(pr);
int k = pr_bit_length;
Expand Down

0 comments on commit d28a83f

Please sign in to comment.