From c91a00ce61f306965fc4a11feadc68d7488c4b29 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 20 Jul 2018 21:45:54 +0200 Subject: [PATCH] d3dcompiler: Use the ARRAY_SIZE() macro. Signed-off-by: Michael Stefaniuc Signed-off-by: Matteo Bruni Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3dcompiler_43/compiler.c | 2 +- dlls/d3dcompiler_43/utils.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c index 36e793ed01c..10c6d01878a 100644 --- a/dlls/d3dcompiler_43/compiler.c +++ b/dlls/d3dcompiler_43/compiler.c @@ -570,7 +570,7 @@ static const struct target_info targets_info[] = { static const struct target_info * get_target_info(const char *target) { LONG min = 0; - LONG max = sizeof(targets_info) / sizeof(targets_info[0]) - 1; + LONG max = ARRAY_SIZE(targets_info) - 1; LONG cur; int res; diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 79f3be8840d..b0232f375d6 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1165,7 +1165,7 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl }; int t1_idx = -1, t2_idx = -1, i; - for (i = 0; i < sizeof(types) / sizeof(types[0]); ++i) + for (i = 0; i < ARRAY_SIZE(types); ++i) { /* Always convert away from HLSL_TYPE_HALF */ if (t1 == types[i]) @@ -1943,7 +1943,7 @@ static const char *debug_node_type(enum hlsl_ir_node_type type) "HLSL_IR_SWIZZLE", }; - if (type >= sizeof(names) / sizeof(names[0])) + if (type >= ARRAY_SIZE(names)) return "Unexpected node type"; return names[type]; }