This seems generally useful, so it may as well live in core Mesa. In fact, the comment for ALIGN() in macros.h actually says to "see also" ROUND_DOWN_TO, which...was in a driver somewhere.
Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> --- src/mesa/drivers/dri/i915/intel_context.h | 13 ------------- src/mesa/main/macros.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index 6edb189..32730a1 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -293,19 +293,6 @@ extern char *__progname; #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 -/** - * Align a value down to an alignment value - * - * If \c value is not already aligned to the requested alignment value, it - * will be rounded down. - * - * \param value Value to be rounded - * \param alignment Alignment value to be used. This must be a power of two. - * - * \sa ALIGN() - */ -#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1)) - static INLINE uint32_t U_FIXED(float value, uint32_t frac_bits) { diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 1052f75..e8fe1d4 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -675,6 +675,18 @@ minify(unsigned value, unsigned levels) */ #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1)) +/** + * Align a value down to an alignment value + * + * If \c value is not already aligned to the requested alignment value, it + * will be rounded down. + * + * \param value Value to be rounded + * \param alignment Alignment value to be used. This must be a power of two. + * + * \sa ALIGN() + */ +#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1)) /** Cross product of two 3-element vectors */ -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev