From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/base/bits.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'chromium/base/bits.h') diff --git a/chromium/base/bits.h b/chromium/base/bits.h index d2c5ac9caa7..20f2ff278f3 100644 --- a/chromium/base/bits.h +++ b/chromium/base/bits.h @@ -7,13 +7,14 @@ #ifndef BASE_BITS_H_ #define BASE_BITS_H_ +#include #include #include #include +#include "base/check.h" #include "base/compiler_specific.h" -#include "base/logging.h" #include "build/build_config.h" #if defined(COMPILER_MSVC) @@ -203,6 +204,16 @@ inline int Log2Ceiling(uint32_t n) { return (n ? 32 : -1) - CountLeadingZeroBits(n - 1); } +// Returns a value of type T with a single bit set in the left-most position. +// Can be used instead of manually shifting a 1 to the left. +template +constexpr T LeftmostBit() { + static_assert(std::is_integral::value, + "This function can only be used with integral types."); + T one(1u); + return one << ((CHAR_BIT * sizeof(T) - 1)); +} + } // namespace bits } // namespace base -- cgit v1.2.1