[PATCH] d3dcompiler: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Fri Jul 20 14:45:54 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 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 36e793ed01..10c6d01878 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 79f3be8840..b0232f375d 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];
 }
-- 
2.14.4




More information about the wine-devel mailing list