summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_util.h
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2019-09-13 08:56:11 +0200
committerChristian Gmeiner <[email protected]>2019-09-17 05:50:37 +0000
commit1c34d19f904c4c9903eb6e8aefd2a8d383da396d (patch)
tree5a7582a5cdc7f294c3b8a1843610cd17417cfc46 /src/gallium/drivers/etnaviv/etnaviv_util.h
parentd61b67b41d64bba83ace7810bbcd2f7baefd8cb9 (diff)
etnaviv: a bit of micro-optimization
Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Jonathan Marek <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_util.h')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_util.h b/src/gallium/drivers/etnaviv/etnaviv_util.h
index 62f62548d2c..75b72adb5cc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_util.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_util.h
@@ -30,6 +30,9 @@
/* for conditionally setting boolean flag(s): */
#define COND(bool, val) ((bool) ? (val) : 0)
+#define foreach_bit(b, mask) \
+ for (uint32_t _m = (mask); _m && ({(b) = u_bit_scan(&_m); 1;});)
+
/* align to a value divisable by granularity >= value, works only for powers of two */
static inline uint32_t
etna_align_up(uint32_t value, uint32_t granularity)