* lib/u64.h: Include limits.h, for INT_MAX. Use uint64_t only if
INT_MAX < UINT64_MAX, to avoid undefined behavior on theoretical
platforms where adding two uint64_t expressions can have undefined
behavior on signed integer overflow.
+2025-08-31 Paul Eggert <eggert@cs.ucla.edu>
+
+ u64: avoid theoretical problem with >64-bit int
+ * lib/u64.h: Include limits.h, for INT_MAX. Use uint64_t only if
+ INT_MAX < UINT64_MAX, to avoid undefined behavior on theoretical
+ platforms where adding two uint64_t expressions can have undefined
+ behavior on signed integer overflow.
+
2024-08-25 Bruno Haible <bruno@clisp.org>
nstrftime tests: Test in the UTF-8 environment on native Windows.
-/* uint64_t-like operations that work even on hosts lacking uint64_t
+/* Unsigned integers with arithmetic modulo 2**64
Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc.
#error "Please include config.h first."
#endif
+#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#endif
-#ifdef UINT64_MAX
+#if defined UINT64_MAX && INT_MAX < UINT64_MAX
/* Native implementations are trivial. See below for comments on what
these operations do. */
Description:
-uint64_t-like operations that work even on hosts lacking uint64_t
+Unsigned integers with arithmetic modulo 2**64
Files:
lib/u64.h