[Mesa-dev] [PATCH] util/blitter: use ARRAY_SIZE macro
Marek Olšák
maraeo at gmail.com
Mon Apr 25 17:18:28 UTC 2016
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Mon, Apr 25, 2016 at 5:48 PM, Brian Paul <brianp at vmware.com> wrote:
> And remove local definition of Elements() macro.
> ---
> src/gallium/auxiliary/util/u_blitter.h | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
> index ed4a232..32ee884 100644
> --- a/src/gallium/auxiliary/util/u_blitter.h
> +++ b/src/gallium/auxiliary/util/u_blitter.h
> @@ -32,12 +32,6 @@
>
> #include "pipe/p_state.h"
>
> -/* u_memory.h conflicts with st/mesa */
> -#ifndef Elements
> -#define Elements(x) (sizeof(x)/sizeof((x)[0]))
> -#endif
> -
> -
> #ifdef __cplusplus
> extern "C" {
> #endif
> @@ -464,7 +458,7 @@ util_blitter_save_fragment_sampler_states(
> unsigned num_sampler_states,
> void **sampler_states)
> {
> - assert(num_sampler_states <= Elements(blitter->saved_sampler_states));
> + assert(num_sampler_states <= ARRAY_SIZE(blitter->saved_sampler_states));
>
> blitter->saved_num_sampler_states = num_sampler_states;
> memcpy(blitter->saved_sampler_states, sampler_states,
> @@ -477,7 +471,7 @@ util_blitter_save_fragment_sampler_views(struct blitter_context *blitter,
> struct pipe_sampler_view **views)
> {
> unsigned i;
> - assert(num_views <= Elements(blitter->saved_sampler_views));
> + assert(num_views <= ARRAY_SIZE(blitter->saved_sampler_views));
>
> blitter->saved_num_sampler_views = num_views;
> for (i = 0; i < num_views; i++)
> @@ -501,7 +495,7 @@ util_blitter_save_so_targets(struct blitter_context *blitter,
> struct pipe_stream_output_target **targets)
> {
> unsigned i;
> - assert(num_targets <= Elements(blitter->saved_so_targets));
> + assert(num_targets <= ARRAY_SIZE(blitter->saved_so_targets));
>
> blitter->saved_num_so_targets = num_targets;
> for (i = 0; i < num_targets; i++)
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list