From 50433ea526942dbeac75cc415becadea157e5d33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 31 Jan 2015 17:15:16 +0100 Subject: [PATCH] gallium/util: add u_bit_scan64 Same as u_bit_scan, but for uint64_t. Reviewed-by: Glenn Kennard Reviewed-by: Brian Paul --- src/gallium/auxiliary/util/u_math.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index ca6d0f1dfc8..8eb840f1ec0 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -583,6 +583,13 @@ u_bit_scan(unsigned *mask) return i; } +static INLINE int +u_bit_scan64(uint64_t *mask) +{ + int i = ffsll(*mask) - 1; + *mask &= ~(1llu << i); + return i; +} /** * Return float bits. -- 2.30.2