Re: Reducing the chunk header sizes on all memory context types
| От | Tom Lane |
|---|---|
| Тема | Re: Reducing the chunk header sizes on all memory context types |
| Дата | |
| Msg-id | 3680169.1661876253@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Reducing the chunk header sizes on all memory context types (David Rowley <dgrowleyml@gmail.com>) |
| Список | pgsql-hackers |
David Rowley <dgrowleyml@gmail.com> writes:
> Here's a patch which adds a comment to MemoryContextMethodID to Robert's patch.
OK, but while looking at that I noticed the adjacent
#define MEMORY_CONTEXT_METHODID_MASK \
UINT64CONST((1 << MEMORY_CONTEXT_METHODID_BITS) - 1)
I'm rather astonished that that compiles; UINT64CONST was only ever
meant to be applied to *literals*. I think what it's expanding to
is
((1 << MEMORY_CONTEXT_METHODID_BITS) - 1UL)
(or on some machines 1ULL) which only accidentally does approximately
what you want. It'd be all right perhaps to write
((UINT64CONST(1) << MEMORY_CONTEXT_METHODID_BITS) - 1)
but you might as well avoid the Postgres-ism and just write
((uint64) ((1 << MEMORY_CONTEXT_METHODID_BITS) - 1))
Nobody's ever going to make MEMORY_CONTEXT_METHODID_BITS large
enough for the shift to overflow in int arithmetic.
regards, tom lane
В списке pgsql-hackers по дате отправления: