diff options
author | 2022-02-16 10:44:28 -0800 | |
---|---|---|
committer | 2022-03-23 15:44:03 -0700 | |
commit | a7fe7eb75957872935b934633ca3e614ed0944c5 (patch) | |
tree | 5a7fddd078b910b646ec0f66f4840edd5c2492b6 /include/ftl/enum.h | |
parent | af5fa6bf7519e780e017cd1af87ed0a4b3dcb5b8 (diff) |
FTL: Remove libutils dependency of Flags
Also, fix the __builtin type suffix in flag_string to avoid truncation
of upper bits for 64-bit flags on platforms with 32-bit unsigned long.
Bug: 185536303
Test: ftl_test
Change-Id: I1719255cc4dd60ec3203e111c37d6851471c631d
Diffstat (limited to 'include/ftl/enum.h')
-rw-r--r-- | include/ftl/enum.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/ftl/enum.h b/include/ftl/enum.h index 5234c051b1..82af1d6cf8 100644 --- a/include/ftl/enum.h +++ b/include/ftl/enum.h @@ -261,10 +261,10 @@ constexpr std::optional<std::string_view> flag_name(E v) { const auto value = to_underlying(v); // TODO: Replace with std::popcount and std::countr_zero in C++20. - if (__builtin_popcountl(value) != 1) return {}; + if (__builtin_popcountll(value) != 1) return {}; constexpr auto kRange = details::EnumRange<E, details::FlagName>{}; - return kRange.values[__builtin_ctzl(value)]; + return kRange.values[__builtin_ctzll(value)]; } // Returns a stringified enumerator, or its integral value if not named. |