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: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-07-09T06:41:42Z
Lists: pgsql-hackers
On Mon, Jun 23, 2025 at 3:01 PM Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> 0001 is a trivial bug fix for the test code in src/tools/testint128.c
> -- it was using "union" instead of "struct" for test128.hl, which
> meant that it was only ever setting and checking half of each 128-bit
> integer in the tests.

Hi Dean, I went to take a look at this and got stuck at building the
test file. The usual pointing gcc to the src and build include
directories didn't cut it. How did you get it to work?

--
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.