3 ms·
First of all, you forgot to return the actual sum from the function. Second, original add_overflow-style functions support arbitrary expressions as input argume
by Joker_vD 3y ago
First of all, you forgot to return the actual sum from the function. Second, original add_overflow-style functions support arbitrary expressions as input arguments, not just pointers to l-values. And third, there is no way all this stuff is going to get optimized down to inlined
add rdi, rsi
setc eax
mov [rdx], rdi
- maldev 3y agoReturn value is returned in a, it returns true or false on whether overflow happened. And you're assuming that you're on x86_64. You can't do that in C. C is platform independent. Which is why I said you can use one of the functions or intrinsics, and writing it yourself is bad, but still easy.