Re:Bitwise Division
by workaccount1 on Wednesday March 01, 2023 @07:49AM
(#34981785)
> Keep in mind that this doesn't use the fact that we know that the input is between 0 to 63.
You can use __builtin_assume for this: https://godbolt.org/z/K4jKhxnTq
Re:Bitwise Division
by pantalaimon on Wednesday March 01, 2023 @08:38AM
(#34982233)
An assert() also does the trick: https://godbolt.org/z/MecvMGPdW
Re:Bitwise Division
by RenThraysk on Wednesday March 01, 2023 @03:46PM
(#34988083)
9*x/64 still reduces to 2 instructions
Keep in mind that this doesn't use the fact that we know that the input is between 0 to 63.