diff options
author | Alon Zakai <azakai@google.com> | 2019-04-26 16:59:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 16:59:41 -0700 |
commit | db9124f1de0478dcac525009b6f1589b44a7edd8 (patch) | |
tree | fa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/support/bits.h | |
parent | 87636dccd404a340d75acb1d96301581343f29ca (diff) | |
download | binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2 binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip |
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
Diffstat (limited to 'src/support/bits.h')
-rw-r--r-- | src/support/bits.h | 24 |
1 files changed, 8 insertions, 16 deletions
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<typename T> -int PopCount(T v) { +template<typename T> int PopCount(T v) { return PopCount(typename std::make_unsigned<T>::type(v)); } -template<typename T> -int CountTrailingZeroes(T v) { +template<typename T> int CountTrailingZeroes(T v) { return CountTrailingZeroes(typename std::make_unsigned<T>::type(v)); } -template<typename T> -int CountLeadingZeroes(T v) { +template<typename T> int CountLeadingZeroes(T v) { return CountLeadingZeroes(typename std::make_unsigned<T>::type(v)); } -template<typename T> -bool IsPowerOf2(T v) { - return v != 0 && PopCount(v) == 1; -} +template<typename T> bool IsPowerOf2(T v) { return v != 0 && PopCount(v) == 1; } -template<typename T, typename U> -inline static T RotateLeft(T val, U count) { +template<typename T, typename U> inline static T RotateLeft(T val, U count) { T mask = sizeof(T) * CHAR_BIT - 1; count &= mask; return (val << count) | (val >> (-count & mask)); } -template<typename T, typename U> -inline static T RotateRight(T val, U count) { +template<typename T, typename U> 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 |