| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com> |
| Cc: | Joseph Koshakow <koshy44(at)gmail(dot)com>, Matthew Kim <matthewkmkim(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> |
| Subject: | Re: Remove dependence on integer wrapping |
| Date: | 2024-08-14 03:07:44 |
| Message-ID: | ZrwfgNyDXy99NUOS@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Aug 13, 2024 at 04:46:34PM -0500, Nathan Bossart wrote:
> I've been preparing 0001 for commit. I've attached what I have so far.
>
> The main changes are the implementations of pg_abs_* and pg_neg_*. For the
> former, I've used abs()/i64abs() for the short/int implementations. For
> the latter, I've tried to use __builtin_sub_overflow() when possible, as
> that appears to produce slightly better code. When
> __builtin_sub_overflow() is not available, the values are upcasted before
> negation, and we check that result before casting to the return type. That
> approach more closely matches the surrounding functions. (One exception is
> pg_neg_u64_overflow() when we have neither HAVE__BUILTIN_OP_OVERFLOW nor
> HAVE_INT128. In that case, we have to hand-roll everything.)
And here's a new version of the patch in which I've attempted to fix the
silly mistakes.
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v20-0001-Remove-dependence-on-integer-wrapping.patch | text/plain | 14.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2024-08-14 03:09:07 | Re: Logical Replication of sequences |
| Previous Message | Imseih (AWS), Sami | 2024-08-14 02:40:48 | Re: query_id, pg_stat_activity, extended query protocol |