diff options
author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2019-11-15 22:49:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-15 22:49:20 +0100 |
commit | 3026aec9bd2c5217ccaea5d00d4463493bb68286 (patch) | |
tree | 9eb76fec0c779ca53477c1b3bdf03a9909718ea2 | |
parent | Merge pull request #3047 from ReinUsesLisp/clip-control (diff) | |
parent | common/bit_field: Silence sign-conversion warnings (diff) | |
download | yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.gz yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.bz2 yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.lz yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.xz yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.tar.zst yuzu-3026aec9bd2c5217ccaea5d00d4463493bb68286.zip |
-rw-r--r-- | src/common/bit_field.h | 5 |
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: /// Constants to allow limited introspection of fields if needed static constexpr std::size_t position = Position; static constexpr std::size_t bits = Bits; - static constexpr StorageType mask = (((StorageType)~0) >> (8 * sizeof(T) - bits)) << position; + static constexpr StorageType mask = StorageType( + (std::numeric_limits<StorageType>::max() >> (8 * sizeof(T) - bits)) << position); /** * Formats a value by masking and shifting it according to the field parameters. A value @@ -143,7 +144,7 @@ public: * the results together. */ static constexpr FORCE_INLINE StorageType FormatValue(const T& value) { - return ((StorageType)value << position) & mask; + return (static_cast<StorageType>(value) << position) & mask; } /** |