aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-05-29 22:54:34 +0200
committerGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-07-16 09:05:29 +0200
commit47a001722d7ada681e333e991373e19d159c380b (patch)
treecb8871d30e4cb67e4224ff9e59d34acc38774378
parent584f7aced5360654d3f86dd14beb87a637b802f1 (diff)
BitField: Add an explicit evaluation method.
Sometimes it can be beneficial to use this in places where an explicit cast needs to happen otherwise. By using the evaluation method, it's not necessary anymore to explicitly write the underlying type in this case.
-rw-r--r--src/common/bit_field.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index dfd00d19..a39bb988 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -132,6 +132,11 @@ public:
__forceinline operator T() const
{
+ return Value();
+ }
+
+ __forceinline T Value() const
+ {
if (std::numeric_limits<T>::is_signed)
{
std::size_t shift = 8 * sizeof(T)-bits;