diff options
Diffstat (limited to 'backend/lib/MC/MCSection.cpp')
| -rw-r--r-- | backend/lib/MC/MCSection.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/backend/lib/MC/MCSection.cpp b/backend/lib/MC/MCSection.cpp index 21ba410..464dcc6 100644 --- a/backend/lib/MC/MCSection.cpp +++ b/backend/lib/MC/MCSection.cpp @@ -2,6 +2,7 @@ #include "rcc/MC/MCSection.h" +#include <bit> #include <cstdint> #include <string_view> @@ -19,16 +20,12 @@ namespace { return true; } -[[nodiscard]] bool isPowerOfTwo(std::uint64_t Value) noexcept { - return Value != 0 && (Value & (Value - 1U)) == 0; -} - } // namespace Expected<void> MCSectionDesc::verify() const { if (!isValidAssemblyName(Name)) return makeUnexpected(ErrorCode::InvalidArgument, "MC section has an invalid name"); - if (!isPowerOfTwo(Alignment)) { + if (!std::has_single_bit(Alignment)) { return makeUnexpected(ErrorCode::InvalidArgument, "MC section alignment must be a nonzero power of two"); } |
