diff --git a/src/util/mpz.h b/src/util/mpz.h index c48d7e708..8c68a42b6 100644 --- a/src/util/mpz.h +++ b/src/util/mpz.h @@ -96,7 +96,7 @@ private: // This gives us: // - On 32-bit platforms: 31 bits, range [-2^30, 2^30-1] // - On 64-bit platforms: 63 bits, range [-2^62, 2^62-1] - static constexpr unaigned SMALL_BITS = sizeof(uintptr_t) * 8 - 1; + static constexpr unsigned SMALL_BITS = sizeof(uintptr_t) * 8 - 1; // Maximum and minimum values that can be stored as small integers static constexpr int64_t SMALL_INT_MAX = (static_cast(1) << (SMALL_BITS - 1)) - 1; @@ -174,6 +174,10 @@ public: return *this; } + void swap(mpz & other) noexcept { + std::swap(m_value, other.m_value); + } + void set64(int64_t v) { SASSERT(is_small()); SASSERT(fits_in_small(v)); diff --git a/src/util/util.h b/src/util/util.h index 8146ac0d2..aec42116b 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -103,8 +103,8 @@ static inline unsigned next_power_of_two(unsigned v) { /** \brief Return the position of the most significant bit. */ -static inline unsigned log2(unsigned v) { return std::bit_width(x) - 1; } -static inline unsigned log2(uint64_t v) { return std::bit_width(x) - 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_assert(sizeof(unsigned) == 4, "unsigned are 32 bits");