3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Use parity helper functions

This commit is contained in:
Jakob Rath 2023-02-08 15:11:39 +01:00
parent bf03886a87
commit a0f5386bdd
5 changed files with 33 additions and 40 deletions

View file

@ -501,6 +501,15 @@ public:
return k;
}
/** Number of trailing zeros in an N-bit representation */
unsigned parity(unsigned num_bits) const {
SASSERT(!is_neg());
SASSERT(*this < rational::power_of_two(num_bits));
if (is_zero())
return num_bits;
return trailing_zeros();
}
static bool limit_denominator(rational &num, rational const& limit);
};