From 5fde5abd3e29368a072f5cab65a61e0bc2c00c49 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 26 Jul 2024 22:41:46 +0200 Subject: [PATCH] cogl: Remove unnecessary compiler functions defines Part-of: --- cogl/cogl/cogl-bitmask.c | 6 +++--- cogl/cogl/cogl-bitmask.h | 8 ++++---- cogl/cogl/cogl-flags.h | 2 +- cogl/cogl/cogl-util.h | 4 ---- cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c | 2 +- cogl/cogl/winsys/cogl-winsys-glx.c | 6 +++--- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/cogl/cogl/cogl-bitmask.c b/cogl/cogl/cogl-bitmask.c index 0bb7d4555..e5cc0bfce 100644 --- a/cogl/cogl/cogl-bitmask.c +++ b/cogl/cogl/cogl-bitmask.c @@ -285,7 +285,7 @@ _cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask) int i; for (i = 0; i < array->len; i++) - pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + pop += __builtin_popcountl (g_array_index (array, unsigned long, i)); return pop; } @@ -307,10 +307,10 @@ _cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask, int i; for (i = 0; i < array_index; i++) - pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + pop += __builtin_popcountl (g_array_index (array, unsigned long, i)); top_mask = g_array_index (array, unsigned long, array_index); - return pop + _cogl_util_popcountl (top_mask & ((1UL << bit_index) - 1)); + return pop + __builtin_popcountl (top_mask & ((1UL << bit_index) - 1)); } } diff --git a/cogl/cogl/cogl-bitmask.h b/cogl/cogl/cogl-bitmask.h index a73e68e4d..1f18b8fbb 100644 --- a/cogl/cogl/cogl-bitmask.h +++ b/cogl/cogl/cogl-bitmask.h @@ -281,7 +281,7 @@ _cogl_bitmask_popcount (const CoglBitmask *bitmask) { return (_cogl_bitmask_has_array (bitmask) ? _cogl_bitmask_popcount_in_array (bitmask) : - _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask))); + __builtin_popcountl (_cogl_bitmask_to_bits (bitmask))); } /* @@ -301,10 +301,10 @@ _cogl_bitmask_popcount_upto (const CoglBitmask *bitmask, if (_cogl_bitmask_has_array (bitmask)) return _cogl_bitmask_popcount_upto_in_array (bitmask, upto); else if (upto >= (int) COGL_BITMASK_MAX_DIRECT_BITS) - return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask)); + return __builtin_popcountl (_cogl_bitmask_to_bits (bitmask)); else - return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask) & - ((1UL << upto) - 1)); + return __builtin_popcountl (_cogl_bitmask_to_bits (bitmask) & + ((1UL << upto) - 1)); } G_END_DECLS diff --git a/cogl/cogl/cogl-flags.h b/cogl/cogl/cogl-flags.h index 6e91e4781..4020cb27a 100644 --- a/cogl/cogl/cogl-flags.h +++ b/cogl/cogl/cogl-flags.h @@ -111,7 +111,7 @@ G_BEGIN_DECLS \ while (_mask) \ { \ - int _next_bit = _cogl_util_ffsl (_mask); \ + int _next_bit = __builtin_ffsl (_mask); \ (bit) += _next_bit; \ /* This odd two-part shift is to avoid */ \ /* shifting by sizeof (long)*8 which has */ \ diff --git a/cogl/cogl/cogl-util.h b/cogl/cogl/cogl-util.h index 04cd23ae4..040c78afa 100644 --- a/cogl/cogl/cogl-util.h +++ b/cogl/cogl/cogl-util.h @@ -80,7 +80,3 @@ _cogl_util_one_at_a_time_mix (unsigned int hash) return hash; } - -#define _cogl_util_ffsl __builtin_ffsl - -#define _cogl_util_popcountl __builtin_popcountl diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index 9532b604a..93d7c308d 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -621,7 +621,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline, for (i = 0; i < n_uniform_longs; i++) data.n_differences += - _cogl_util_popcountl (data.uniform_differences[i]); + __builtin_popcountl (data.uniform_differences[i]); } while (pipeline && data.n_differences > 0) diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 166a03808..9a7da34e4 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -1067,9 +1067,9 @@ try_create_glx_pixmap (CoglContext *context, * number of 1-bits in color masks against the color depth requested * by the client. */ - if (_cogl_util_popcountl (visual->red_mask | - visual->green_mask | - visual->blue_mask) == depth) + if (__builtin_popcountl (visual->red_mask | + visual->green_mask | + visual->blue_mask) == depth) attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT; else attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT;