mcl: Fix bug in non-template mcl::bit::ones

This commit is contained in:
Merry
2022-04-19 18:04:33 +01:00
parent 95422b2091
commit ed9955891f
4 changed files with 44 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ constexpr T ones(size_t count) {
if (count == 0) {
return 0;
}
return ~static_cast<T>(0) >> (bitsizeof<T> - count);
return static_cast<T>(~static_cast<T>(0)) >> (bitsizeof<T> - count);
}
/// Create a mask of type T for bits [begin_bit, end_bit] inclusive.