diff options
author | Paul Berry <[email protected]> | 2012-12-17 13:48:21 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-01-08 09:08:57 -0800 |
commit | 8706395f25228d0e622cc56346c7181ba102edf4 (patch) | |
tree | a864b8b39c8c691943762cef3b587e7c47ed1e63 /src/mesa/main/macros.h | |
parent | 09df6bb96d5d7b987de6cd48d87d175e5cd2ccf3 (diff) |
mesa: Add ALIGN() macro to main/macros.h.
Previously this macro existed in 3 separate places, some inside the
intel driver and some outside of it. It makes more sense to have it
in main/macros.h
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r-- | src/mesa/main/macros.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 14a5d5fe16e..d1e81fe082c 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -656,6 +656,19 @@ 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)) +/** + * Align a value up to an alignment value + * + * If \c value is not already aligned to the requested alignment value, it + * will be rounded up. + * + * \param value Value to be rounded + * \param alignment Alignment value to be used. This must be a power of two. + * + * \sa ROUND_DOWN_TO() + */ +#define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1)) + /** Cross product of two 3-element vectors */ |