Anonymous
7/21/2025, 7:23:27 PM
No.105979652
checking for overflow by doing the arithmetic op is a rookie mistake. Compilers will always """optimize""" it as if it could not happen because they decided UB means fuck you that's why.
And doing any sort of limit comparisons is fucking retarded, especially for multiplication.
GCC and clang have __builtin_add_overflow which gives you boolean. It compiles to carry flag on most architectures, which is how you should check for overflow in assembly anyway.
Actually not sure what it does on risc-v since they don't have carry
And doing any sort of limit comparisons is fucking retarded, especially for multiplication.
GCC and clang have __builtin_add_overflow which gives you boolean. It compiles to carry flag on most architectures, which is how you should check for overflow in assembly anyway.
Actually not sure what it does on risc-v since they don't have carry