From 50433ea526942dbeac75cc415becadea157e5d33 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 31 Jan 2015 17:15:16 +0100 Subject: 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(+) (limited to 'src/gallium/auxiliary/util/u_math.h') 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. -- cgit v1.2.3