From bb5a53820703f5e1af886a0c5ca7178aa976be29 Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Thu, 25 Apr 2024 09:25:15 +0200 Subject: use of stdckdint.h C23 is going to have this header. The industry is already moving towards accepting it; OSes and compilers started to implement theirs. Why not detect its presence and if any, prefer over other ways. See also: - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2683.pdf - https://reviews.freebsd.org/D41734 - https://reviews.llvm.org/D157331 - https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8441841a1b985d68245954af1ff023db121b0635 --- gc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 41207b6eb2..59201458f1 100644 --- a/gc.c +++ b/gc.c @@ -224,6 +224,9 @@ size_add_overflow(size_t x, size_t y) bool p; #if 0 +#elif defined(ckd_add) + p = ckd_add(&z, x, y); + #elif __has_builtin(__builtin_add_overflow) p = __builtin_add_overflow(x, y, &z); -- cgit v1.2.3