Commit fa9e6f89 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Properly enable base::bits::IsPowerOfTwo() only for integral types.

As explained by jdoerrie@ here:
https://crrev.com/c/2253564/4/base/pickle.cc

Change-Id: Ie36ac8f031d261819a9e9226f7226be1b6247898
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315418
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791638}
parent 070fe487
...@@ -25,8 +25,7 @@ namespace base { ...@@ -25,8 +25,7 @@ namespace base {
namespace bits { namespace bits {
// Returns true iff |value| is a power of 2. // Returns true iff |value| is a power of 2.
template <typename T, template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
typename = typename std::enable_if<std::is_integral<T>::value>>
constexpr bool IsPowerOfTwo(T value) { constexpr bool IsPowerOfTwo(T value) {
// From "Hacker's Delight": Section 2.1 Manipulating Rightmost Bits. // From "Hacker's Delight": Section 2.1 Manipulating Rightmost Bits.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment