On 3/12/20 7:58 AM, LIU Zhiwei wrote: > +#define DO_MADC(N, M, C) ((__typeof(N))(N + M + C) < N ? 1 : 0)
Incorrect. E.g N = 1, M = UINT_MAX, C = 1, adds to 1, which is not less than N, despite the carry-out. You want C ? N + M <= N : N + M < N > +#define DO_MSBC(N, M, C) ((__typeof(N))(N - M - C) > N ? 1 : 0) Similarly C ? N <= M : N < M r~