Hi Hackers,
This patch uses left/right shift operators to optimize *2 and /2 operations in some functions that are in critical paths.
For unsigned int, *2 and /2 exactly equal to <<1 and >>1.
For signed int:
* /2 exactly equals to >>1 when a value is non-negative, this patch ensures only changes non-negative variables
* *2 might be different from <<1 if a value is close to MAX_INT, however, in that case x*2 will result in a undefined result, thus existing code should have ensured *2 should not exceed MAX_INT.
"make check" passes with this patch.
Best regards,
Chao Li (Evan)
---------------------