Re: [PATCH 03/14] hash: use uint32_t for object_id algorithm
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Nov 3, 2025, 01:30 UTC
- Message-ID
- <aQgFvfMwPcXgYHX7@fruit.crustytoothpaste.net>
- In-Reply-To
- <874irh6tgj.fsf@gmail.com>
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 intRust 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