summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2018-09-06 13:24:18 -0700
committerDylan Baker <[email protected]>2020-04-21 11:09:03 -0700
commite190e8cef2eaeabc16dda0cbd56addcd81968834 (patch)
tree9213598b68eebf32568170ebc7ba951a250ac96c /src/util
parente533fad182e7069ee0850154f51316dd779501c3 (diff)
replace _mesa_next_pow_two_* with util_next_power_of_two_*
The 64 bit variant in imports.h isn't even used. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/imports.h52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/util/imports.h b/src/util/imports.h
index 03a6c0ef358..22364c68840 100644
--- a/src/util/imports.h
+++ b/src/util/imports.h
@@ -190,58 +190,6 @@ static inline int IFLOOR(float f)
#endif
}
-/**
- * Round given integer to next higer power of two
- * If X is zero result is undefined.
- *
- * Source for the fallback implementation is
- * Sean Eron Anderson's webpage "Bit Twiddling Hacks"
- * http://graphics.stanford.edu/~seander/bithacks.html
- *
- * When using builtin function have to do some work
- * for case when passed values 1 to prevent hiting
- * undefined result from __builtin_clz. Undefined
- * results would be different depending on optimization
- * level used for build.
- */
-static inline int32_t
-_mesa_next_pow_two_32(uint32_t x)
-{
-#ifdef HAVE___BUILTIN_CLZ
- uint32_t y = (x != 1);
- return (1 + y) << ((__builtin_clz(x - y) ^ 31) );
-#else
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x++;
- return x;
-#endif
-}
-
-static inline int64_t
-_mesa_next_pow_two_64(uint64_t x)
-{
-#ifdef HAVE___BUILTIN_CLZLL
- uint64_t y = (x != 1);
- STATIC_ASSERT(sizeof(x) == sizeof(long long));
- return (1 + y) << ((__builtin_clzll(x - y) ^ 63));
-#else
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x |= x >> 32;
- x++;
- return x;
-#endif
-}
-
/*
* Returns the floor form of binary logarithm for a 32-bit integer.