From eaa93d7177504d82aff423b9c28f1fceefe3791c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 3 Oct 2022 15:40:14 -0600 Subject: [PATCH] cso: use util_bitcount Signed-off-by: Brian Paul Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/cso_cache/cso_hash.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c b/src/gallium/auxiliary/cso_cache/cso_hash.c index 0112f46f0df..a0c23560426 100644 --- a/src/gallium/auxiliary/cso_cache/cso_hash.c +++ b/src/gallium/auxiliary/cso_cache/cso_hash.c @@ -32,6 +32,7 @@ #include "util/u_debug.h" #include "util/u_memory.h" +#include "util/bitscan.h" #include "cso_hash.h" @@ -61,13 +62,7 @@ primeForNumBits(int numBits) static int countBits(int hint) { - int numBits = 0; - int bits = hint; - - while (bits > 1) { - bits >>= 1; - numBits++; - } + int numBits = util_bitcount(hint); if (numBits >= (int)sizeof(prime_deltas)) { numBits = sizeof(prime_deltas) - 1;