diff --git a/include/util/bitutils.h b/include/util/bitutils.h index 57dbd1fa5..370a432fd 100644 --- a/include/util/bitutils.h +++ b/include/util/bitutils.h @@ -44,6 +44,8 @@ Dest BitwiseCast(Src source) { // SetBits returns an integer of type with bits set // for position through , counting from the least // significant bit. In particular when Num == 0, no positions are set to 1. +// A static assert will be triggered if First + Num > sizeof(T) * 8, that is, +// a bit that will not fit in the underlying type is set. template struct SetBits { static_assert(First < sizeof(T) * 8,