summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-17 18:35:00 -0800
committerEmil Velikov <[email protected]>2015-12-03 18:43:11 +0000
commita6be31fc250aae4b4a1711d162dd6957d03884eb (patch)
tree81930651cf840fd93d36d596abd84adbf8d402ad
parent895ec179439d3222319da5cbf1e2b8fb102b5dc4 (diff)
glsl: Fix off-by-one error in array size check assertion
Apparently, this has been a bug since 2010 (c30f6e5d). Also use ARRAY_SIZE instead of open coding it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected] (cherry picked from commit 2f554761536bbfd0d8ec22e807c18bd6df0f22b8)
-rw-r--r--src/glsl/ir.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 724861b1e9f..f092bc4f615 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1402,8 +1402,7 @@ static const char * const tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf
const char *ir_texture::opcode_string()
{
- assert((unsigned int) op <=
- sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]));
+ assert((unsigned int) op < ARRAY_SIZE(tex_opcode_strs));
return tex_opcode_strs[op];
}