From db9124f1de0478dcac525009b6f1589b44a7edd8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 26 Apr 2019 16:59:41 -0700 Subject: Apply format changes from #2048 (#2059) Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048 --- src/support/bits.h | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/support/bits.h') diff --git a/src/support/bits.h b/src/support/bits.h index f1dc4364f..f2241bea8 100644 --- a/src/support/bits.h +++ b/src/support/bits.h @@ -56,31 +56,23 @@ extern template int CountLeadingZeroes(uint64_t); // Convenience signed -> unsigned. It usually doesn't make much sense to use bit // functions on signed types. -template -int PopCount(T v) { +template int PopCount(T v) { return PopCount(typename std::make_unsigned::type(v)); } -template -int CountTrailingZeroes(T v) { +template int CountTrailingZeroes(T v) { return CountTrailingZeroes(typename std::make_unsigned::type(v)); } -template -int CountLeadingZeroes(T v) { +template int CountLeadingZeroes(T v) { return CountLeadingZeroes(typename std::make_unsigned::type(v)); } -template -bool IsPowerOf2(T v) { - return v != 0 && PopCount(v) == 1; -} +template bool IsPowerOf2(T v) { return v != 0 && PopCount(v) == 1; } -template -inline static T RotateLeft(T val, U count) { +template inline static T RotateLeft(T val, U count) { T mask = sizeof(T) * CHAR_BIT - 1; count &= mask; return (val << count) | (val >> (-count & mask)); } -template -inline static T RotateRight(T val, U count) { +template inline static T RotateRight(T val, U count) { T mask = sizeof(T) * CHAR_BIT - 1; count &= mask; return (val >> count) | (val << (-count & mask)); @@ -89,6 +81,6 @@ inline static T RotateRight(T val, U count) { extern uint32_t Log2(uint32_t v); extern uint32_t Pow2(uint32_t v); -} // namespace wasm +} // namespace wasm -#endif // wasm_support_bits_h +#endif // wasm_support_bits_h -- cgit v1.2.3