Discussion:
Remove ARRAY_SIZE macro which is identical to ARRAY_ELEMS
(too old to reply)
Anton Mitrofanov
2018-01-18 20:23:03 UTC
Permalink
Raw Message
x264 | branch: master | Anton Mitrofanov <***@narod.ru> | Wed Jan 17 22:03:06 2018 +0300| [7d0ff22e8c96de126be9d3de4952edd6d1b75a8c] | committer: Henrik Gramner

Remove ARRAY_SIZE macro which is identical to ARRAY_ELEMS
http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=7d0ff22e8c96de126be9d3de4952edd6d1b75a8c
---

common/base.h | 1 -
common/opencl.c | 2 +-
tools/checkasm.c | 4 ++--
3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/common/base.h b/common/base.h
index cb990ff0..145220ba 100644
--- a/common/base.h
+++ b/common/base.h
@@ -55,7 +55,6 @@
#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 )
#define FIX8(f) ((int)(f*(1<<8)+.5))
#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0])))
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1))
#define IS_DISPOSABLE(type) ( type == X264_TYPE_B )

diff --git a/common/opencl.c b/common/opencl.c
index 50298ab0..cebf9338 100644
--- a/common/opencl.c
+++ b/common/opencl.c
@@ -364,7 +364,7 @@ static int opencl_lookahead_alloc( x264_t *h )
if( !h->opencl.lookahead_program )
goto fail;

- for( int i = 0; i < ARRAY_SIZE(kernelnames); i++ )
+ for( int i = 0; i < ARRAY_ELEMS(kernelnames); i++ )
{
*kernels[i] = ocl->clCreateKernel( h->opencl.lookahead_program, kernelnames[i], &status );
if( status != CL_SUCCESS )
diff --git a/tools/checkasm.c b/tools/checkasm.c
index 0fed4c8b..440e1d23 100644
--- a/tools/checkasm.c
+++ b/tools/checkasm.c
@@ -1808,7 +1808,7 @@ static int check_mc( int cpu_ref, int cpu_new )
float *fix8_src = (float*)(buf3 + 0x800);
uint16_t *dstc = (uint16_t*)buf3;
uint16_t *dsta = (uint16_t*)buf4;
- for( int i = 0; i < ARRAY_SIZE(mbtree_fix8_counts); i++ )
+ for( int i = 0; i < ARRAY_ELEMS(mbtree_fix8_counts); i++ )
{
int count = mbtree_fix8_counts[i];

@@ -1835,7 +1835,7 @@ static int check_mc( int cpu_ref, int cpu_new )
uint16_t *fix8_src = (uint16_t*)(buf3 + 0x800);
float *dstc = (float*)buf3;
float *dsta = (float*)buf4;
- for( int i = 0; i < ARRAY_SIZE(mbtree_fix8_counts); i++ )
+ for( int i = 0; i < ARRAY_ELEMS(mbtree_fix8_counts); i++ )
{
int count = mbtree_fix8_counts[i];

Loading...