util/tgsi: use ASSERT_BITFIELD_SIZE() to check opcode field size
authorBrian Paul <brianp@vmware.com>
Tue, 7 Nov 2017 01:11:38 +0000 (18:11 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 17 Nov 2017 03:35:17 +0000 (20:35 -0700)
I've noticed at least two places where we store the TGSI opcode in
an unsigned:8 bitfield.  We're at 249 opcodes now.  If we hit 256 we'll
need to grow those bitfields.  Use the new ASSERT_BITFIELD_SIZE() macro
to detect that.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/tgsi/tgsi_info.c

index 4e399508e5b2603dea896cc37b86b53e00efd4ee..c39de0edfcd962578af9e215175a38212ab20072 100644 (file)
@@ -55,6 +55,8 @@ tgsi_get_opcode_info( uint opcode )
 {
    static boolean firsttime = 1;
 
+   ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, opcode, TGSI_OPCODE_LAST - 1);
+
    if (firsttime) {
       unsigned i;
       firsttime = 0;