summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-17 18:35:00 -0800
committerIan Romanick <[email protected]>2015-11-18 18:35:56 -0800
commit2f554761536bbfd0d8ec22e807c18bd6df0f22b8 (patch)
tree3a33ff50a2681a36a8ea1d7542f0e3448a58e70a
parent0aded03046a5dd73bedece767dea8559463a7a57 (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]
-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 8b5ba71fbba..80cbdbf613f 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1425,8 +1425,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];
}