https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90094

Paul Eggert <eggert at cs dot ucla.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eggert at cs dot ucla.edu

--- Comment #3 from Paul Eggert <eggert at cs dot ucla.edu> ---
Slightly better is this equivalent:

unsigned f (long a)
{
  return __builtin_sub_overflow (0, a, &a);
}

which gcc -O2 (or -Os) compiles into:

f:      xor     %eax, %eax
        neg     %rdi
        seto    %al
        ret

which with GCC is one byte less machine code than the __builtin_sub_overflow(a,
1, &a) approach.

Reply via email to