From 14ab4e9a9b24e14a1f54aefa0d6835319ad7e0f3 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 14 Jun 2021 15:20:58 -0400 Subject: [PATCH] util/prim_restart: use more direct conversion for restart index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_prim_restart.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/util/u_prim_restart.h b/src/gallium/auxiliary/util/u_prim_restart.h index 453c1281d8d..e4c8b6fd29f 100644 --- a/src/gallium/auxiliary/util/u_prim_restart.h +++ b/src/gallium/auxiliary/util/u_prim_restart.h @@ -63,14 +63,8 @@ util_draw_vbo_without_prim_restart(struct pipe_context *context, static inline unsigned util_prim_restart_index_from_size(unsigned index_size) { - if (index_size == 1) - return 0xff; - if (index_size == 2) - return 0xffff; - if (index_size == 4) - return 0xffffffff; - unreachable("unknown index size passed"); - return 0; + /* 1 -> 0xff, 2 -> 0xffff, 4 -> 0xffffffff */ + return 0xffffffffu >> 8 * (4 - index_size); } #ifdef __cplusplus