diff options
Diffstat (limited to 'backend/lib/MC/MCStreamer.cpp')
| -rw-r--r-- | backend/lib/MC/MCStreamer.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/backend/lib/MC/MCStreamer.cpp b/backend/lib/MC/MCStreamer.cpp index 56c3f96..709dccc 100644 --- a/backend/lib/MC/MCStreamer.cpp +++ b/backend/lib/MC/MCStreamer.cpp @@ -4,6 +4,7 @@ #include <algorithm> #include <array> +#include <bit> #include <cctype> #include <cstddef> #include <cstdint> @@ -23,10 +24,6 @@ namespace { Text.find('\r') != std::string_view::npos; } -[[nodiscard]] bool isPowerOfTwo(std::uint64_t Value) noexcept { - return Value != 0 && (Value & (Value - 1U)) == 0; -} - [[nodiscard]] unsigned log2Exact(std::uint64_t Value) noexcept { unsigned Result = 0; while (Value > 1) { @@ -282,7 +279,7 @@ Expected<void> AsmTextStreamer::emitAlignment(std::uint64_t Alignment, std::uint auto Active = requireActiveSection(); if (!Active) return std::unexpected(Active.error()); - if (!isPowerOfTwo(Alignment)) { + if (!std::has_single_bit(Alignment)) { return makeUnexpected(ErrorCode::InvalidArgument, "assembly alignment must be a nonzero power of two"); } |
