Skip to content

Commit 1a88495

Browse files
committed
panko: core: Fixed off-by-one in the smallest_type_for
1 parent 3c1abf2 commit 1a88495

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/panko/core/bitfield.hh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ namespace Panko::core {
4444
using type = T;
4545
};
4646

47-
/* BUG(aki): I have no idea *why* this is not working properly but alas */
4847
template<std::size_t bits>
4948
using smallest_type_for = std::tuple_element_t<
50-
((bits + 7) / 8), std::tuple<
49+
((bits + 7U) / 8U) - 1U, std::tuple<
5150
std::uint8_t, /* <= 1 byte */
5251
std::uint16_t, /* <= 2 bytes */
5352
std::uint32_t, /* <= 3 bytes */

0 commit comments

Comments
 (0)