Complete the code to replace multiplication by 2 with a faster operation.
result = x [1] 1
Using the left shift operator (<<) by 1 is equivalent to multiplying by 2, which is faster in many processors.
Complete the code to replace division by 4 with a faster operation.
result = x [1] 2
Right shifting by 2 bits (>>) divides the number by 4 efficiently.
Fix the error in the strength reduction code replacing multiplication by 8.
result = x [1] 3
Multiplying by 8 is equivalent to left shifting by 3 bits.
Fill both blanks to replace multiplication and division by powers of two with shifts.
mul_result = x [1] 2 div_result = y [2] 1
Multiplying by 4 is left shift by 2 bits, dividing by 2 is right shift by 1 bit. Here, the code uses shifts for both operations.
Fill all three blanks to apply strength reduction for multiplication and division by powers of two.
a = b [1] 2 c = d [2] 3 e = f [3] 4
Multiplying by 2 is left shift by 1 bit, dividing by 8 and 16 uses right shift '>>' by 3 and 4 bits respectively. This shows strength reduction for both multiplication and division.