dakersnar wrote:

I think you're right. Since the only thing that really matters for 
commonAlignment is the number of trailing zeros of each input, we can 
generalize whether we need the `abs` to the following statement: "will a number 
and it's two's compliment always have the same number of trailing zeros?". And 
the answer is yes, because negating will turn the least significant 1 followed 
by trailing 0s into a 0 followed by trailing 1s, and then adding 1 will revert 
those bits back to the original pattern, leaving the same number of trailing 
zeros.

Is there any merit to keeping the abs for readability, so future maintainers 
don't need to reason through this? Maybe just a comment?

https://github.com/llvm/llvm-project/pull/145733
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to