Comment on Always Bump Downwards (2019)Comments−asalahli2yThe rust code for rounding down is given as let new_ptr = new_ptr & !(align - 1); But I don't see rdx decremented before being negated and AND'ed with rax, in the assembly. What am I missing?−conradludgate2yIt's being converted into `-align` which is equivalent under twos compliment−asalahli2yI don't follow. Are you saying `new_ptr & -align` is equivalent to `new_ptr & !(align - 1)`?Edit: I get it now. My brain was interpreting NEG as NOT for some reason.
Comments
The rust code for rounding down is given as
But I don't see rdx decremented before being negated and AND'ed with rax, in the assembly. What am I missing?It's being converted into `-align` which is equivalent under twos compliment
I don't follow. Are you saying `new_ptr & -align` is equivalent to `new_ptr & !(align - 1)`?
Edit: I get it now. My brain was interpreting NEG as NOT for some reason.