3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 11:35:42 +00:00

Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Nikolaj Bjorner 2026-07-14 22:15:15 -07:00 committed by GitHub
parent c1c01b418f
commit 20bba3e452
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,9 +103,9 @@ static inline unsigned next_power_of_two(unsigned v) {
/**
\brief Return the position of the most significant bit.
*/
static inline unsigned log2(int v) { return std::bit_width((unsigned)v) - 1; }
static inline unsigned log2(unsigned v) { return std::bit_width(v) - 1; }
static inline unsigned log2(uint64_t v) { return std::bit_width(v) - 1; }
static inline unsigned log2(int v) { return v > 0 ? (std::bit_width(static_cast<unsigned>(v)) - 1) : 0; }
static inline unsigned log2(unsigned v) { return v ? (std::bit_width(v) - 1) : 0; }
static inline unsigned log2(uint64_t v) { return v ? (std::bit_width(v) - 1) : 0; }
static_assert(sizeof(unsigned) == 4, "unsigned are 32 bits");