4 ms·
x >> 2 resulting in SAR is quite logical. I'm more concerned about x / 2 resulting in the off-by-one error mentioned in the paper, if x is LLONG_MIN. LLONG_MIN
by freshbob 6y ago
x >> 2 resulting in SAR is quite logical.
I'm more concerned about
x / 2 resulting in the off-by-one error mentioned in the paper, if x is LLONG_MIN. LLONG_MIN / 2 = 0 in with their optimization.
https://godbolt.org/z/EtyNsR https://godbolt.org/z/EtyNsR
- CalChris 6y agoDoh. Sorry about that. https://godbolt.org/z/xWmjpP https://godbolt.org/z/xWmjpP return x / 2 baz: # @baz mov rax, rdi shr rax, 63 add rax, rdi sar rax ret
- Thorrez 6y ago> x / 2 resulting in the off-by-one error mentioned in the paper, if x is LLONG_MIN. LLONG_MIN / 2 = 0 in with their optimization. Are you saying clang is leading to an off-by-one error? The code seems to behave correctly to me.