mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-23 12:10:06 +00:00
Updated comment in SetBits.
It now mentions that it will fail if you try to set a bit that does not exist.
This commit is contained in:
parent
bae8851111
commit
b3ae4b9422
@ -44,6 +44,8 @@ Dest BitwiseCast(Src source) {
|
|||||||
// SetBits<T, First, Num> returns an integer of type <T> with bits set
|
// SetBits<T, First, Num> returns an integer of type <T> with bits set
|
||||||
// for position <First> through <First + Num - 1>, counting from the least
|
// for position <First> through <First + Num - 1>, counting from the least
|
||||||
// significant bit. In particular when Num == 0, no positions are set to 1.
|
// 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 <typename T, size_t First = 0, size_t Num = 0>
|
template <typename T, size_t First = 0, size_t Num = 0>
|
||||||
struct SetBits {
|
struct SetBits {
|
||||||
static_assert(First < sizeof(T) * 8,
|
static_assert(First < sizeof(T) * 8,
|
||||||
|
Loading…
Reference in New Issue
Block a user