summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/macros.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-04-13 01:46:09 -0700
committerEric Anholt <[email protected]>2013-04-21 12:28:04 -0700
commit47c0b5ecdd14ab5b07e4d3016e8dff7c9c3abb8b (patch)
treef2ea5c4e3860d6fd7911b50d4440f3fda6807163 /src/mesa/main/macros.h
parent1842dd08b83269816fe8eb8f2dcc1252f606fe48 (diff)
mesa: Introduce a globally-available minify() macro.
This matches u_minify()'s behavior, for consistency. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r--src/mesa/main/macros.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index f6d38fb6480..b206acacf4a 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -656,6 +656,12 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], const GLfloat in[4])
#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+static inline unsigned
+minify(unsigned value, unsigned levels)
+{
+ return MAX2(1, value >> levels);
+}
+
/**
* Align a value up to an alignment value
*