diff --git a/libclc/generic/lib/integer/abs_diff.inc b/libclc/generic/lib/integer/abs_diff.inc --- a/libclc/generic/lib/integer/abs_diff.inc +++ b/libclc/generic/lib/integer/abs_diff.inc @@ -1,3 +1,5 @@ _CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y) { - return __builtin_astype((__CLC_GENTYPE)(x > y ? x-y : y-x), __CLC_U_GENTYPE); + __CLC_U_GENTYPE ux = __builtin_astype(x, __CLC_U_GENTYPE); + __CLC_U_GENTYPE uy = __builtin_astype(y, __CLC_U_GENTYPE); + return x > y ? ux - uy : uy - ux; }