[Mesa-dev] [PATCH v2 1/9] util/macros: Import ALIGN_POT from ralloc.c
Jason Ekstrand
jason at jlekstrand.net
Mon Jul 2 16:50:17 UTC 2018
On Mon, Jul 2, 2018 at 9:23 AM, Brian Paul <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>> 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/
--Jason
> -Brian
>
>
>
>
>> -Brian
>>
>>
>> +
>> /**
>> * Macro for declaring an explicit conversion operator.
>> Defaults to an
>> * implicit conversion if C++11 is not supported.
>> diff --git a/src/util/ralloc.c b/src/util/ralloc.c
>> index 42cfa2e391d..5d77f75ee85 100644
>> --- a/src/util/ralloc.c
>> +++ b/src/util/ralloc.c
>> @@ -553,8 +553,6 @@ ralloc_vasprintf_rewrite_tail(char **str,
>> size_t *start, const char *fmt,
>> * other buffers.
>> */
>> -#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1))
>> -
>> #define MIN_LINEAR_BUFSIZE 2048
>> #define SUBALLOC_ALIGNMENT sizeof(uintptr_t)
>> #define LMAGIC 0x87b9c7d3
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180702/ffd755a8/attachment-0001.html>
More information about the mesa-dev
mailing list