Re: [PATCH] Add function to_oct

Поиск
Список
Период
Сортировка
От Eric Radman
Тема Re: [PATCH] Add function to_oct
Дата
Msg-id Y6SWxEM92Pbqs0l/@vm3.eradman.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add function to_oct  (Dag Lem <dag@nimrod.no>)
Ответы Re: [PATCH] Add function to_oct  (vignesh C <vignesh21@gmail.com>)
Список pgsql-hackers
On Thu, Dec 22, 2022 at 10:08:17AM +0000, Dag Lem wrote:
> 
> The calculation of quotient and remainder can be replaced by less costly masking and shifting.
> 
> Defining
> 
> #define OCT_DIGIT_BITS 3
> #define OCT_DIGIT_BITMASK 0x7
> 
> the content of the loop can be replaced by
> 
>         *--ptr = digits[value & OCT_DIGIT_BITMASK];
>         value >>= OCT_DIGIT_BITS;
> 
> Also, the check for ptr > buf in the while loop can be removed. The
> check is superfluous, since buf cannot possibly be exhausted by a 32
> bit integer (the maximum octal number being 37777777777).

I integrated these suggestions in the attached -v2 patch and tested
range of values manually.

Also picked an OID > 8000 as suggested by unused_oids.

..Eric

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Small miscellaneus fixes (Part II)
Следующее
От: Nikita Malakhov
Дата:
Сообщение: Re: [PATCH] Infinite loop while acquiring new TOAST Oid