Hello all,
I got the answer that fastest way to multiply by 7 is n<<3 - n, but why?
If the question is to multiply by 8, then n<<3 is considerably better than n*8, because bitwise operation is faster. But when we multiply by 7, we are also subtracting n, it may be more cumbersome than multiplying directly with 7.
please answer,
Suyash
I got the answer that fastest way to multiply by 7 is n<<3 - n, but why?
If the question is to multiply by 8, then n<<3 is considerably better than n*8, because bitwise operation is faster. But when we multiply by 7, we are also subtracting n, it may be more cumbersome than multiplying directly with 7.
please answer,
Suyash
Comment