diff options
| author | 2019-11-16 03:29:37 -0300 | |
|---|---|---|
| committer | 2019-11-16 03:29:37 -0300 | |
| commit | 8ed0d92e32db961fb6307ebaa31908a1f8e08461 (patch) | |
| tree | ddfd5d15ff0a055cdd4b4aa5df85c0b2bfc56713 /src/common/bit_field.h | |
| parent | Merge pull request #3106 from lioncash/bitfield (diff) | |
| download | yuzu-8ed0d92e32db961fb6307ebaa31908a1f8e08461.tar.gz yuzu-8ed0d92e32db961fb6307ebaa31908a1f8e08461.tar.xz yuzu-8ed0d92e32db961fb6307ebaa31908a1f8e08461.zip | |
Revert "common/bit_field: Silence sign-conversion warnings"
Diffstat (limited to '')
| -rw-r--r-- | src/common/bit_field.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 2dbe37839..fd2bbbd99 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h | |||
| @@ -135,8 +135,7 @@ 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( | 138 | static constexpr StorageType mask = (((StorageType)~0) >> (8 * sizeof(T) - bits)) << position; |
| 139 | (std::numeric_limits<StorageType>::max() >> (8 * sizeof(T) - bits)) << position); | ||
| 140 | 139 | ||
| 141 | /** | 140 | /** |
| 142 | * Formats a value by masking and shifting it according to the field parameters. A value | 141 | * Formats a value by masking and shifting it according to the field parameters. A value |
| @@ -144,7 +143,7 @@ public: | |||
| 144 | * the results together. | 143 | * the results together. |
| 145 | */ | 144 | */ |
| 146 | static constexpr FORCE_INLINE StorageType FormatValue(const T& value) { | 145 | static constexpr FORCE_INLINE StorageType FormatValue(const T& value) { |
| 147 | return (static_cast<StorageType>(value) << position) & mask; | 146 | return ((StorageType)value << position) & mask; |
| 148 | } | 147 | } |
| 149 | 148 | ||
| 150 | /** | 149 | /** |