[Mesa-dev] [PATCH v2 1/9] util/macros: Import ALIGN_POT from ralloc.c
Brian Paul
brianp at vmware.com
Mon Jul 2 17:05:05 UTC 2018
On 07/02/2018 10:50 AM, Jason Ekstrand wrote:
> On Mon, Jul 2, 2018 at 9:23 AM, Brian Paul <brianp at vmware.com
> <mailto:brianp at vmware.com>> wrote:
>
> On 07/02/2018 09:00 AM, Jason Ekstrand wrote:
>
> On Mon, Jul 2, 2018 at 6:33 AM, Brian Paul <brianp at vmware.com
> <mailto:brianp at vmware.com> <mailto:brianp at vmware.com
> <mailto:brianp at vmware.com>>> wrote:
>
> On 06/29/2018 06:13 PM, Jason Ekstrand wrote:
>
> ---
> src/util/macros.h | 3 +++
> src/util/ralloc.c | 2 --
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/util/macros.h b/src/util/macros.h
> index 6d3df904082..95b86c7a31a 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -285,6 +285,9 @@ do { \
> #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 to a power of two */
> +#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1))
>
>
> Maybe improve the comment to say that y must be a power of
> two value?
>
> Maybe rename 'y' to 'pot'?
>
>
> Do you want one or both? I've sent a v2 which just renames "y"
> to "align_pot" and leaves the comment alone.
>
>
> That's fine.
>
>
> The same macro is in src/util/slab.c and build_id.c too (at
> least).
>
>
> Good catch. Fixed in v2.
>
>
> Do you mean v3? I haven't seen a newer patch in my inbox yet.
>
>
> I guess so? I think I accidentally called the new one v2 as well. It's
> here:
>
> https://patchwork.freedesktop.org/patch/235957/
Looks good.
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list