mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[util] Fix a non-explicit-typed shift in sized_uint
In basic_types.h, `sized_uint<N>` was shifting a mask by the bit width of the type, which meant it wouldn't work for 64 bit types.
This commit is contained in:
@@ -68,7 +68,7 @@ template <> struct sized_uint_type<32> { using type = uint32_t; };
|
|||||||
template <> struct sized_uint_type<64> { using type = uint64_t; };
|
template <> struct sized_uint_type<64> { using type = uint64_t; };
|
||||||
|
|
||||||
template <unsigned N> struct sized_uint {
|
template <unsigned N> struct sized_uint {
|
||||||
static constexpr uint64_t mask = ((1<<N)-1);
|
static constexpr uint64_t mask = ((1ull<<N)-1);
|
||||||
static constexpr unsigned bits = N;
|
static constexpr unsigned bits = N;
|
||||||
using type = typename sized_uint_type<N>::type;
|
using type = typename sized_uint_type<N>::type;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user