[Mesa-dev] [PATCH 4/4] util/tgsi: use ASSERT_BITFIELD_SIZE() to check opcode field size
Nicolai Hähnle
nhaehnle at gmail.com
Wed Nov 8 09:54:42 UTC 2017
For the series:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 08.11.2017 01:07, Brian Paul wrote:
> 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.
> ---
> src/gallium/auxiliary/tgsi/tgsi_info.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
> index 4e39950..23dc95a 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
> @@ -27,6 +27,7 @@
>
> #include "util/u_debug.h"
> #include "util/u_memory.h"
> +#include "util/bitfield_assert.h"
> #include "tgsi_info.h"
>
> #define NONE TGSI_OUTPUT_NONE
> @@ -55,6 +56,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;
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list