mirror of
https://github.com/Z3Prover/z3
synced 2026-03-01 11:16:54 +00:00
optimize has_sign_bit and mod2k to not compute powers of two
this is very useful for bitvectors of large bitwidths
This commit is contained in:
parent
74cbd6de32
commit
09370d7782
6 changed files with 97 additions and 34 deletions
|
|
@ -836,9 +836,7 @@ rational bv_recognizers::norm(rational const & val, unsigned bv_size, bool is_si
|
|||
|
||||
bool bv_recognizers::has_sign_bit(rational const & n, unsigned bv_size) const {
|
||||
SASSERT(bv_size > 0);
|
||||
rational m = norm(n, bv_size, false);
|
||||
rational p = rational::power_of_two(bv_size - 1);
|
||||
return m >= p;
|
||||
return numerator(n).get_bit(bv_size - 1) == 1;
|
||||
}
|
||||
|
||||
bool bv_recognizers::is_bv_sort(sort const * s) const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue