diff options
Diffstat (limited to 'deps/v8/src/base/bits.h')
-rw-r--r-- | deps/v8/src/base/bits.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/deps/v8/src/base/bits.h b/deps/v8/src/base/bits.h index 731a7181d7..147a1730b2 100644 --- a/deps/v8/src/base/bits.h +++ b/deps/v8/src/base/bits.h @@ -146,6 +146,14 @@ constexpr inline bool IsPowerOfTwo(T value) { V8_BASE_EXPORT uint32_t RoundUpToPowerOfTwo32(uint32_t value); // Same for 64 bit integers. |value| must be <= 2^63 V8_BASE_EXPORT uint64_t RoundUpToPowerOfTwo64(uint64_t value); +// Same for size_t integers. +inline size_t RoundUpToPowerOfTwo(size_t value) { + if (sizeof(size_t) == sizeof(uint64_t)) { + return RoundUpToPowerOfTwo64(value); + } else { + return RoundUpToPowerOfTwo32(value); + } +} // RoundDownToPowerOfTwo32(value) returns the greatest power of two which is // less than or equal to |value|. If you pass in a |value| that is already a |