1
0
Fork 0
forked from suyu/suyu

Revert "common/bit_field: Silence sign-conversion warnings"

This commit is contained in:
Rodrigo Locatti 2019-11-16 03:29:37 -03:00 committed by GitHub
parent 3026aec9bd
commit 8ed0d92e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,8 +135,7 @@ 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(
(std::numeric_limits<StorageType>::max() >> (8 * sizeof(T) - bits)) << position);
static constexpr StorageType mask = (((StorageType)~0) >> (8 * sizeof(T) - bits)) << position;
/**
* Formats a value by masking and shifting it according to the field parameters. A value
@ -144,7 +143,7 @@ public:
* the results together.
*/
static constexpr FORCE_INLINE StorageType FormatValue(const T& value) {
return (static_cast<StorageType>(value) << position) & mask;
return ((StorageType)value << position) & mask;
}
/**