News for hackers. Stuff that matters.
Re:Arithmetic Shifting Considered Harmful (1976) [pdf] by freshbob on Saturday April 25, 2020 @07:42PM (#22982675)
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

Re:Arithmetic Shifting Considered Harmful (1976) [pdf] by Thorrez on Saturday April 25, 2020 @08:32PM (#22983026)
> 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.

Re:Arithmetic Shifting Considered Harmful (1976) [pdf] by CalChris on Saturday April 25, 2020 @07:50PM (#22982726)
Doh. Sorry about that.

https://godbolt.org/z/xWmjpP

return x / 2

baz: # @baz mov rax, rdi shr rax, 63 add rax, rdi sar rax ret