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

speedup bit_vector::num_words()

Proof of equivalence w.r.t. previous code: http://rise4fun.com/Z3/aiLV

Signed-off-by: Nuno Lopes <t-nclaud@microsoft.com>
This commit is contained in:
Nuno Lopes 2013-03-25 15:41:52 -07:00
parent da83a6b28c
commit 25a41d48dc

View file

@ -37,7 +37,8 @@ class bit_vector {
}
static unsigned num_words(unsigned num_bits) {
return (num_bits % 32) == 0 ? (num_bits / 32) : ((num_bits / 32) + 1);
// return (num_bits % 32) == 0 ? (num_bits / 32) : ((num_bits / 32) + 1);
return (num_bits + 31) / 32;
}
void expand_to(unsigned new_capacity);