summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2019-11-15 18:49:20 -0300
committerGravatar GitHub2019-11-15 18:49:20 -0300
commit3026aec9bd2c5217ccaea5d00d4463493bb68286 (patch)
tree9eb76fec0c779ca53477c1b3bdf03a9909718ea2
parentMerge pull request #3047 from ReinUsesLisp/clip-control (diff)
parentcommon/bit_field: Silence sign-conversion warnings (diff)
downloadyuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.gz
yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.xz
yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.zip
Merge pull request #3106 from lioncash/bitfield
common/bit_field: Silence sign-conversion warnings
Diffstat (limited to '')
-rw-r--r--src/common/bit_field.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index fd2bbbd99..2dbe37839 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -135,7 +135,8 @@ public:
135 /// Constants to allow limited introspection of fields if needed 135 /// Constants to allow limited introspection of fields if needed
136 static constexpr std::size_t position = Position; 136 static constexpr std::size_t position = Position;
137 static constexpr std::size_t bits = Bits; 137 static constexpr std::size_t bits = Bits;
138 static constexpr StorageType mask = (((StorageType)~0) >> (8 * sizeof(T) - bits)) << position; 138 static constexpr StorageType mask = StorageType(
139 (std::numeric_limits<StorageType>::max() >> (8 * sizeof(T) - bits)) << position);
139 140
140 /** 141 /**
141 * Formats a value by masking and shifting it according to the field parameters. A value 142 * Formats a value by masking and shifting it according to the field parameters. A value
@@ -143,7 +144,7 @@ public:
143 * the results together. 144 * the results together.
144 */ 145 */
145 static constexpr FORCE_INLINE StorageType FormatValue(const T& value) { 146 static constexpr FORCE_INLINE StorageType FormatValue(const T& value) {
146 return ((StorageType)value << position) & mask; 147 return (static_cast<StorageType>(value) << position) & mask;
147 } 148 }
148 149
149 /** 150 /**