Subject: Re: [PATCH 03/14] hash: use uint32_t for object_id algorithm

From: "brian m. carlson" <[email-masked]>
Date: Mon, 3 Nov 2025 01:30:37 +0000

On 2025-10-30 at 01:58:52, Collin Funk wrote:
> I guess intmax_t and uintmax_t are probably not usable with Rust, since
> they are not fixed width?

They are effectively 64 bit everywhere, so `i64` or `u64` is
appropriate.  These types are not actually the largest possible integers
anymore, since they were originally defined as 64 bit and implementers
refused to change them once 128-bit values were supported because that
would break ABI.

With gcc or clang, you can do this to see:

    % clang -E -dM - </dev/null | grep INTMAX_TYPE
    #define __INTMAX_TYPE__ long int
    #define __UINTMAX_TYPE__ long unsigned int

Rust also has `i128` and `u128`, which are part of the ABI and are also
used for things like `std::time::Duration::as_nanos`.  Rust claims that
it is ABI-compatible with C's `__int128` where that exists, but it does
not in all C compilers and on all architectures.  Compatibility with C's
`_BitInt(128)` is explicitly disclaimed.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA