From 027cbf00f248bda325521db8f56a3718898da46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= Date: Tue, 2 Aug 2016 08:46:04 +0200 Subject: util: Move _mesa_fsl/util_last_bit into util/bitscan.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As requested with the initial creation of util/bitscan.h now move other bitscan related functions into util. v2: Split into two patches. Signed-off-by: Mathias Fröhlich Tested-by: Brian Paul Reviewed-by: Brian Paul --- src/gallium/auxiliary/util/u_math.h | 64 ------------------------------------- 1 file changed, 64 deletions(-) (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 1661e63..a923271 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -347,70 +347,6 @@ util_half_inf_sign(int16_t x) /** - * Find last bit set in a word. The least significant bit is 1. - * Return 0 if no bits are set. - */ -static inline unsigned -util_last_bit(unsigned u) -{ -#if defined(HAVE___BUILTIN_CLZ) - return u == 0 ? 0 : 32 - __builtin_clz(u); -#else - unsigned r = 0; - while (u) { - r++; - u >>= 1; - } - return r; -#endif -} - -/** - * Find last bit set in a word. The least significant bit is 1. - * Return 0 if no bits are set. - */ -static inline unsigned -util_last_bit64(uint64_t u) -{ -#if defined(HAVE___BUILTIN_CLZLL) - return u == 0 ? 0 : 64 - __builtin_clzll(u); -#else - unsigned r = 0; - while (u) { - r++; - u >>= 1; - } - return r; -#endif -} - -/** - * Find last bit in a word that does not match the sign bit. The least - * significant bit is 1. - * Return 0 if no bits are set. - */ -static inline unsigned -util_last_bit_signed(int i) -{ - if (i >= 0) - return util_last_bit(i); - else - return util_last_bit(~(unsigned)i); -} - -/* Returns a bitfield in which the first count bits starting at start are - * set. - */ -static inline unsigned -u_bit_consecutive(unsigned start, unsigned count) -{ - assert(start + count <= 32); - if (count == 32) - return ~0; - return ((1u << count) - 1) << start; -} - -/** * Return float bits. */ static inline unsigned -- cgit v1.1