[Mesa-dev] [prefix=PATCH v3 2/3] util: Move ALIGN from mesa/main/macros.h to util/macros.h

Ian Romanick idr at freedesktop.org
Thu Oct 30 09:52:58 PDT 2014


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 10/29/2014 05:25 PM, Jason Ekstrand wrote:
> ---
>  src/mesa/main/bitset.h |  1 +
>  src/mesa/main/macros.h | 27 ---------------------------
>  src/util/macros.h      | 27 +++++++++++++++++++++++++++
>  3 files changed, 28 insertions(+), 27 deletions(-)
> 
> diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
> index f50b14f..dbf1af9 100644
> --- a/src/mesa/main/bitset.h
> +++ b/src/mesa/main/bitset.h
> @@ -33,6 +33,7 @@
>  
>  #include "imports.h"
>  #include "util/bitcount.h"
> +#include "util/macros.h"
>  
>  /****************************************************************************
>   * generic bitset implementation
> diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
> index cd5f2d6..33cc583 100644
> --- a/src/mesa/main/macros.h
> +++ b/src/mesa/main/macros.h
> @@ -702,33 +702,6 @@ is_power_of_two(unsigned value)
>     return (value & (value - 1)) == 0;
>  }
>  
> -/**
> - * 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))
> -
> -/**
> - * 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 */
>  static inline void
>  CROSS3(GLfloat n[3], const GLfloat u[3], const GLfloat v[3])
> diff --git a/src/util/macros.h b/src/util/macros.h
> index ff37a7d..1b750b6 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -31,6 +31,33 @@
>  
>  
>  /**
> + * 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))
> +
> +/**
> + * 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))
> +
> +
> +/**
>   * __builtin_expect macros
>   */
>  #if !defined(HAVE___BUILTIN_EXPECT)
> 



More information about the mesa-dev mailing list