@@ -42,37 +42,37 @@ The full license is in the LICENSE file, distributed with this software.
4242#endif
4343#include <intsafe.h>
4444#define checked_add (a , b , res ) \
45- _Generic((a), \
46- int: IntAdd, \
47- unsigned int: UIntAdd, \
48- long: LongAdd, \
49- unsigned long: ULongAdd, \
50- long long: LongLongAdd, \
51- unsigned long long: ULongLongAdd, \
52- short: ShortAdd, \
53- unsigned short: UShortAdd)(a, b, res)
45+ _Generic((res), \
46+ int * : IntAdd, \
47+ unsigned int * : UIntAdd, \
48+ long * : LongAdd, \
49+ unsigned long * : ULongAdd, \
50+ long long * : LongLongAdd, \
51+ unsigned long long * : ULongLongAdd, \
52+ short * : ShortAdd, \
53+ unsigned short * : UShortAdd)(a, b, res)
5454
5555#define checked_sub (a , b , res ) \
56- _Generic((a), \
57- int: IntSub, \
58- unsigned int: UIntSub, \
59- long: LongSub, \
60- unsigned long: ULongSub, \
61- long long: LongLongSub, \
62- unsigned long long: ULongLongSub, \
63- short: ShortSub, \
64- unsigned short: UShortSub)(a, b, res)
56+ _Generic((res), \
57+ int * : IntSub, \
58+ unsigned int * : UIntSub, \
59+ long * : LongSub, \
60+ unsigned long * : ULongSub, \
61+ long long * : LongLongSub, \
62+ unsigned long long * : ULongLongSub, \
63+ short * : ShortSub, \
64+ unsigned short * : UShortSub)(a, b, res)
6565
6666#define checked_mul (a , b , res ) \
67- _Generic((a), \
68- int: IntMult, \
69- unsigned int: UIntMult, \
70- long: LongMult, \
71- unsigned long: ULongMult, \
72- long long: LongLongMult, \
73- unsigned long long: ULongLongMult, \
74- short: ShortMult, \
75- unsigned short: UShortMult)(a, b, res)
67+ _Generic((res), \
68+ int * : IntMult, \
69+ unsigned int * : UIntMult, \
70+ long * : LongMult, \
71+ unsigned long * : ULongMult, \
72+ long long * : LongLongMult, \
73+ unsigned long long * : ULongLongMult, \
74+ short * : ShortMult, \
75+ unsigned short * : UShortMult)(a, b, res)
7676
7777#elif (defined(__has_builtin ) && __has_builtin (__builtin_add_overflow )) || \
7878 __GNUC__ > 7
0 commit comments