diff options
| author | 2015-07-11 19:01:57 -0700 | |
|---|---|---|
| committer | 2015-07-11 19:01:57 -0700 | |
| commit | b0d72e3de1ec2350716300c86bc02930893e9e23 (patch) | |
| tree | 9ff3675021806f4e236ffdb73b7c36e44b88a8fc /src/common | |
| parent | Merge pull request #910 from linkmauve/install (diff) | |
| parent | Common: Remove redundant masking in BitField (diff) | |
| download | yuzu-b0d72e3de1ec2350716300c86bc02930893e9e23.tar.gz yuzu-b0d72e3de1ec2350716300c86bc02930893e9e23.tar.xz yuzu-b0d72e3de1ec2350716300c86bc02930893e9e23.zip | |
Merge pull request #914 from yuriks/bitfield-mask
Common: Fix mask generation in BitField
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/bit_field.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 6595b5ba4..f64ebdaf6 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h | |||
| @@ -161,7 +161,7 @@ public: | |||
| 161 | if (std::numeric_limits<T>::is_signed) | 161 | if (std::numeric_limits<T>::is_signed) |
| 162 | { | 162 | { |
| 163 | std::size_t shift = 8 * sizeof(T)-bits; | 163 | std::size_t shift = 8 * sizeof(T)-bits; |
| 164 | return (T)(((storage & GetMask()) << (shift - position)) >> shift); | 164 | return (T)((storage << (shift - position)) >> shift); |
| 165 | } | 165 | } |
| 166 | else | 166 | else |
| 167 | { | 167 | { |
| @@ -189,7 +189,7 @@ private: | |||
| 189 | 189 | ||
| 190 | __forceinline StorageType GetMask() const | 190 | __forceinline StorageType GetMask() const |
| 191 | { | 191 | { |
| 192 | return ((~(StorageTypeU)0) >> (8 * sizeof(T)-bits)) << position; | 192 | return (((StorageTypeU)~0) >> (8 * sizeof(T)-bits)) << position; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | StorageType storage; | 195 | StorageType storage; |