From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Joseph Koshakow <koshy44(at)gmail(dot)com> |
Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, jian he <jian(dot)universality(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 18:16:06 |
Message-ID: | Zrz0Zv4PVFxieEii@nathan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Aug 14, 2024 at 01:41:40PM -0400, Joseph Koshakow wrote:
> Since we know that a does not equal PG_INT64_MIN, could we shorten the
> last three lines and do the following?
>
> static inline uint64
> pg_abs_s64(int64 a)
> {
> if (unlikely(a == PG_INT64_MIN))
> return (uint64) PG_INT64_MAX + 1;
> return i64_abs(a);
> }
Good call. That actually produces seemingly better code, too.
--
nathan
Attachment | Content-Type | Size |
---|---|---|
v22-0001-Remove-dependence-on-integer-wrapping.patch | text/plain | 15.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema-Nio | 2024-08-14 18:18:36 | Re: libpq: Fix lots of discrepancies in PQtrace |
Previous Message | Сергей Соловьев | 2024-08-14 18:08:00 | Re: [PATCH] Add log_transaction setting |