Fix UB in BitField.h

This commit is contained in:
Nekotekina 2017-03-17 20:22:47 +03:00
parent d45d8eb4bc
commit 14b9b12211

View file

@ -36,7 +36,7 @@ struct bf_t : bf_base<T, N>
// Get bitmask of size N, at I pos
static constexpr utype data_mask()
{
return static_cast<utype>(~utype{} >> (bf_t::bitmax - bf_t::bitsize) << bitpos);
return static_cast<utype>(static_cast<utype>(~utype{} >> (bf_t::bitmax - bf_t::bitsize)) << bitpos);
}
// Bitfield extraction helper