From 12841928df1bf6ebfb40fc3691a7912262dac66f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 13 Apr 2014 11:53:44 +0200 Subject: [PATCH] BitField: Optimize generated assembly by forcing inlining. --- Source/Core/Common/BitField.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/BitField.h b/Source/Core/Common/BitField.h index 40e748229e..e1e5ba6546 100644 --- a/Source/Core/Common/BitField.h +++ b/Source/Core/Common/BitField.h @@ -36,6 +36,8 @@ #include #include +#include "Common.h" + /* * Abstract bitfield class * @@ -113,13 +115,13 @@ public: // so that we can use this within unions BitField() = default; - BitField& operator=(T val) + __forceinline BitField& operator=(T val) { storage = (storage & ~GetMask()) | ((val << position) & GetMask()); return *this; } - operator T() const + __forceinline operator T() const { if (std::numeric_limits::is_signed) { @@ -144,7 +146,7 @@ private: // Unsigned version of StorageType typedef typename std::make_unsigned::type StorageTypeU; - StorageType GetMask() const + __forceinline StorageType GetMask() const { return ((~(StorageTypeU)0) >> (8*sizeof(T) - bits)) << position; }