Re: Non-decimal integer literals

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Non-decimal integer literals
Date: 2022-11-29 10:11:00
Message-ID: CAEZATCXa1cEAp-GH8FVgwn3JRg55_tK6TSCrifa4tXmm34dXAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 23 Nov 2022 at 08:56, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Wed, 23 Nov 2022 at 21:54, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> > I wonder if you'd be better off with something like:
> >
> > while (*ptr && isxdigit((unsigned char) *ptr))
> > {
> > if (unlikely(tmp & UINT64CONST(0xF000000000000000)))
> > goto out_of_range;
> >
> > tmp = (tmp << 4) | hexlookup[(unsigned char) *ptr++];
> > }
>
> Here's a delta diff with it changed to work that way.
>

This isn't correct, because those functions are meant to accumulate a
negative number in "tmp".

The overflow check can't just ignore the final digit either, so I'm
not sure how much this would end up saving once those issues are
fixed.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2022-11-29 10:18:24 Re: Reducing power consumption on idle servers
Previous Message Alvaro Herrera 2022-11-29 09:27:08 Re: ExecRTCheckPerms() and many prunable partitions