[Mesa-dev] [PATCH 12/14] r200: replace Elements() with ARRAY_SIZE()

Brian Paul brianp at vmware.com
Sat Feb 28 08:22:46 PST 2015


---
 src/mesa/drivers/dri/r200/r200_sanity.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_sanity.c b/src/mesa/drivers/dri/r200/r200_sanity.c
index 8f7c0fe..ab922e5 100644
--- a/src/mesa/drivers/dri/r200/r200_sanity.c
+++ b/src/mesa/drivers/dri/r200/r200_sanity.c
@@ -609,7 +609,7 @@ struct reg {
 };
 
 
-static struct reg regs[Elements(reg_names)+1];
+static struct reg regs[ARRAY_SIZE(reg_names)+1];
 static struct reg scalars[512+1];
 static struct reg vectors[512*4+1];
 
@@ -620,29 +620,29 @@ static void init_regs( void )
    struct reg_names *tmp;
    int i;
 
-   for (i = 0 ; i < Elements(reg_names) ; i++) {
+   for (i = 0 ; i < ARRAY_SIZE(reg_names) ; i++) {
       regs[i].idx = reg_names[i].idx;
       regs[i].closest = &reg_names[i];
       regs[i].flags = 0;
    }
 
-   for (i = 0, tmp = scalar_names ; i < Elements(scalars) ; i++) {
+   for (i = 0, tmp = scalar_names ; i < ARRAY_SIZE(scalars) ; i++) {
       if (tmp[1].idx == i) tmp++;
       scalars[i].idx = i;
       scalars[i].closest = tmp;
       scalars[i].flags = ISFLOAT;
    }
 
-   for (i = 0, tmp = vector_names ; i < Elements(vectors) ; i++) {
+   for (i = 0, tmp = vector_names ; i < ARRAY_SIZE(vectors) ; i++) {
       if (tmp[1].idx*4 == i) tmp++;
       vectors[i].idx = i;
       vectors[i].closest = tmp;
       vectors[i].flags = ISFLOAT|ISVEC;
    }
 
-   regs[Elements(regs)-1].idx = -1;
-   scalars[Elements(scalars)-1].idx = -1;
-   vectors[Elements(vectors)-1].idx = -1;
+   regs[ARRAY_SIZE(regs)-1].idx = -1;
+   scalars[ARRAY_SIZE(scalars)-1].idx = -1;
+   vectors[ARRAY_SIZE(vectors)-1].idx = -1;
 }
 
 static int find_or_add_value( struct reg *reg, int val )
@@ -786,13 +786,13 @@ static void dump_state( void )
 {
    int i;
 
-   for (i = 0 ; i < Elements(regs) ; i++) 
+   for (i = 0 ; i < ARRAY_SIZE(regs) ; i++) 
       print_reg( &regs[i] );
 
-   for (i = 0 ; i < Elements(scalars) ; i++) 
+   for (i = 0 ; i < ARRAY_SIZE(scalars) ; i++) 
       print_reg( &scalars[i] );
 
-   for (i = 0 ; i < Elements(vectors) ; i++) 
+   for (i = 0 ; i < ARRAY_SIZE(vectors) ; i++) 
       print_reg( &vectors[i] );
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list