4 ms·
The assembly subroutine is not optimal because the compiler can not inline it. A ASM expression [1] is much better. Also, it is weird to write the result to me
by solarexplorer 12y ago
The assembly subroutine is not optimal because the compiler can not inline it. A ASM expression [1] is much better.
Also, it is weird to write the result to memory just to avoid to repeat the addition. A memory operation is quite complex, but there a few things simpler than adding two registers. A better abstraction would be to write a function that returns the overflow bit and nothing else. The addition itself is (almost) free anyway.
[1] http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Extended-Asm.html http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Extended-Asm.htm...