Re: Improving and extending int128.h to more of numeric.c

John Naylor <johncnaylorls@gmail.com>

From: John Naylor <johncnaylorls@gmail.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-07-18T06:47:46Z
Lists: pgsql-hackers
On Thu, Jul 17, 2025 at 2:30 PM Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> BTW, my other motivation for doing this was to simplify the numeric
> code. Even if this had zero performance benefit, as long as it didn't
> make things any slower, I would argue that it's worth doing.

I gathered that was the main motivation, and I agree. I looked over
0005 and don't see any issues.

-- 
John Naylor
Amazon Web Services



Commits

  1. Guard against division by zero in test_int128 module.

  2. Extend int128.h to support more numeric code.

  3. Simplify non-native 64x64-bit multiplication in int128.h.

  4. Optimise non-native 128-bit addition in int128.h.

  5. Refactor int128.h, bringing the native and non-native code together.

  6. Convert src/tools/testint128.c into a test module.