mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 20:11:17 +00:00
mac: on 32 bit, use __builtin_umull_overflow
This commit is contained in:
parent
60c2bf47e4
commit
a0d3847983
@ -55,16 +55,16 @@ GIT_INLINE(bool) git__add_uint64_overflow(uint64_t *out, uint64_t one, uint64_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Use clang/gcc compiler intrinsics whenever possible */
|
/* Use clang/gcc compiler intrinsics whenever possible */
|
||||||
#if (SIZE_MAX == UINT_MAX) && __has_builtin(__builtin_uadd_overflow)
|
#if (SIZE_MAX == ULONG_MAX) && __has_builtin(__builtin_uaddl_overflow)
|
||||||
# define git__add_sizet_overflow(out, one, two) \
|
|
||||||
__builtin_uadd_overflow(one, two, out)
|
|
||||||
# define git__multiply_sizet_overflow(out, one, two) \
|
|
||||||
__builtin_umul_overflow(one, two, out)
|
|
||||||
#elif (SIZE_MAX == ULONG_MAX) && __has_builtin(__builtin_uaddl_overflow)
|
|
||||||
# define git__add_sizet_overflow(out, one, two) \
|
# define git__add_sizet_overflow(out, one, two) \
|
||||||
__builtin_uaddl_overflow(one, two, out)
|
__builtin_uaddl_overflow(one, two, out)
|
||||||
# define git__multiply_sizet_overflow(out, one, two) \
|
# define git__multiply_sizet_overflow(out, one, two) \
|
||||||
__builtin_umull_overflow(one, two, out)
|
__builtin_umull_overflow(one, two, out)
|
||||||
|
#elif (SIZE_MAX == UINT_MAX) && __has_builtin(__builtin_uadd_overflow)
|
||||||
|
# define git__add_sizet_overflow(out, one, two) \
|
||||||
|
__builtin_uadd_overflow(one, two, out)
|
||||||
|
# define git__multiply_sizet_overflow(out, one, two) \
|
||||||
|
__builtin_umul_overflow(one, two, out)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user