diff options
Diffstat (limited to 'compiler-rt/lib/orc/stl_extras.h')
-rw-r--r-- | compiler-rt/lib/orc/stl_extras.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/lib/orc/stl_extras.h b/compiler-rt/lib/orc/stl_extras.h index 33c877b..80a6cd1 100644 --- a/compiler-rt/lib/orc/stl_extras.h +++ b/compiler-rt/lib/orc/stl_extras.h @@ -13,6 +13,7 @@ #ifndef ORC_RT_STL_EXTRAS_H #define ORC_RT_STL_EXTRAS_H +#include <cstdint> #include <utility> #include <tuple> @@ -28,6 +29,17 @@ template <class Ty> struct identity { const Ty &operator()(const Ty &self) const { return self; } }; +/// Substitute for std::bit_ceil. +constexpr uint64_t bit_ceil(uint64_t Val) noexcept { + Val |= (Val >> 1); + Val |= (Val >> 2); + Val |= (Val >> 4); + Val |= (Val >> 8); + Val |= (Val >> 16); + Val |= (Val >> 32); + return Val + 1; +} + } // namespace __orc_rt #endif // ORC_RT_STL_EXTRAS |