diff --git a/CodeEmitter/CodeEmitter/VixlUtils.inl b/CodeEmitter/CodeEmitter/VixlUtils.inl index 96c2185fd..4e8915ec7 100644 --- a/CodeEmitter/CodeEmitter/VixlUtils.inl +++ b/CodeEmitter/CodeEmitter/VixlUtils.inl @@ -158,7 +158,7 @@ static bool IsImmLogical(uint64_t value, unsigned width, unsigned* n = nullptr, } // If the repeat period d is not a power of two, it can't be encoded. - if (!IsPowerOf2(d)) { + if (!std::has_single_bit(uint32_t(d))) { return false; } @@ -284,11 +284,6 @@ INT_1_TO_63_LIST(DECLARE_IS_UINT_N) private: -template -static inline bool IsPowerOf2(V value) { - return (value != 0) && ((value & (value - 1)) == 0); -} - // Some compilers dislike negating unsigned integers, // so we provide an equivalent. template