From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/common/bit_field.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/common/bit_field.h') diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 4748999ed..8d45743e2 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h @@ -1,7 +1,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - // Copyright 2014 Tony Wasserka // All rights reserved. // @@ -29,7 +28,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #pragma once #include @@ -111,9 +109,8 @@ * symptoms. */ #pragma pack(1) -template -struct BitField -{ +template +struct BitField { private: // We hide the copy assigment operator here, because the default copy // assignment would copy the full storage value, rather than just the bits @@ -141,13 +138,10 @@ public: } FORCE_INLINE T Value() const { - if (std::numeric_limits::is_signed) - { - std::size_t shift = 8 * sizeof(T)-bits; + if (std::numeric_limits::is_signed) { + std::size_t shift = 8 * sizeof(T) - bits; return (T)((storage << (shift - position)) >> shift); - } - else - { + } else { return (T)((storage & GetMask()) >> position); } } @@ -162,15 +156,14 @@ private: // T is an enumeration. Note that T is wrapped within an enable_if in the // former case to workaround compile errors which arise when using // std::underlying_type::type directly. - typedef typename std::conditional < std::is_enum::value, - std::underlying_type, - std::enable_if < true, T >> ::type::type StorageType; + typedef typename std::conditional::value, std::underlying_type, + std::enable_if>::type::type StorageType; // Unsigned version of StorageType typedef typename std::make_unsigned::type StorageTypeU; FORCE_INLINE StorageType GetMask() const { - return (((StorageTypeU)~0) >> (8 * sizeof(T)-bits)) << position; + return (((StorageTypeU)~0) >> (8 * sizeof(T) - bits)) << position; } StorageType storage; @@ -186,5 +179,6 @@ private: #pragma pack() #if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER) -static_assert(std::is_trivially_copyable>::value, "BitField must be trivially copyable"); +static_assert(std::is_trivially_copyable>::value, + "BitField must be trivially copyable"); #endif -- cgit v1.2.3