Strength reduction is a program optimization technique that replaces more expensive operations with cheaper ones.
A few examples of strength reduction:
|Expensive operation||Cheaper operation|
|Division by power of 2||a / 2n||a >> n|
|Modulo by power of 2||a % 2n||a & (2n – 1)|
|Replacement of pow() with combination of multiplications, divisions and square roots||pow(a, 0.5)pow(a,1.5)pow(a, -1.5)||sqrt(a)a * sqrt(a)1.0 / (a * sqrt(a))|