From 2741c6464c347946f1392c97731b24c386b9f782 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 17 Jan 2024 13:58:21 -0800 Subject: [PATCH] intel/compiler: Use u_foreach_bit64 in brw_get_compiler_config_value Reviewed-by: Lionel Landwerlin Suggested-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_compiler.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index 9c9b221d17e..06bb63e284c 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -252,19 +252,15 @@ brw_get_compiler_config_value(const struct brw_compiler *compiler) uint64_t mask = DEBUG_DISK_CACHE_MASK; bits += util_bitcount64(mask); - while (mask != 0) { - const uint64_t bit = 1ULL << (ffsll(mask) - 1); - insert_u64_bit(&config, INTEL_DEBUG(bit)); - mask &= ~bit; - } + + u_foreach_bit64(bit, mask) + insert_u64_bit(&config, INTEL_DEBUG(1ULL << bit)); mask = SIMD_DISK_CACHE_MASK; bits += util_bitcount64(mask); - while (mask != 0) { - const uint64_t bit = 1ULL << (ffsll(mask) - 1); - insert_u64_bit(&config, (intel_simd & bit) != 0); - mask &= ~bit; - } + + u_foreach_bit64(bit, mask) + insert_u64_bit(&config, (intel_simd & (1ULL << bit)) != 0); assert(bits <= util_bitcount64(UINT64_MAX));