bitfield: check if specified index is non-negative

Hopefully silences false-positive warnings by Coverity e.g. CID#1590746.
This commit is contained in:
Yu Watanabe
2025-03-19 09:56:04 +09:00
parent d2ce0db7a7
commit c995855266
+1
View File
@@ -7,6 +7,7 @@
#define _INDEX_TO_MASK(type, i, uniq) \
({ \
int UNIQ_T(_i, uniq) = (i); \
assert(UNIQ_T(_i, uniq) >= 0); \
assert(UNIQ_T(_i, uniq) < (int)sizeof(type) * 8); \
((type)1) << UNIQ_T(_i, uniq); \
})