I am currently writing a program in C which needs to run as fast as possible and am currently looking at improving the speed of some of the calculations performed. I am aware that the slowest operations are multiplication and division, and I have replaced my multiplications/divisions by a power of 2 with left/right shifts.
I was wondering if I could do something similar for multiplication by 6, as it seems that this operation pops up a lot in my program. Regularly it is being multiplied by a number which is 1 or 0, and I feel there should be a good way to speed this up but can't think of any.