Re: Improve performance of pg_strtointNN functions - Mailing list pgsql-hackers

From David Rowley
Subject Re: Improve performance of pg_strtointNN functions
Date
Msg-id CAApHDvq_=adeFd+iga05=VZCw4vgN35+kLS-WLJ9vGDCc1cObw@mail.gmail.com
Whole thread Raw
In response to Re: Improve performance of pg_strtointNN functions  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
On Sun, 4 Dec 2022 at 22:53, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> Ah, I see that you changed the overflow test, and I realise that I
> forgot to answer your question about why I wrote that as 1 - INT_MIN /
> 10 over on the other thread.
>
> The reason is that we need to detect whether tmp * base will exceed
> -INT_MIN, not INT_MAX, since we're accumulating the absolute value of
> a signed integer.

I think I'd been too focused on the simplicity of that expression and
also the base 10 part. I saw that everything worked in base 10 and
failed to give enough forward thought to other bases.

I now see that it was wrong-headed to code it the way I had it.
Thanks for pointing this out. I've just pushed a fix.

David



pgsql-hackers by date:

Previous
From: Maciek Sakrejda
Date:
Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Next
From: Noah Misch
Date:
Subject: Re: restoring user id and SecContext before logging error in ri_PlanCheck