Wonder which is faster (or perhaps more compact?), using INPUT<<2 and two adds, or INPUT<<3 and one add?

But, yes, these little tricks can save a LOT of cycles.  And cause a lot of debugging grief...  I sometimes wish the tool chain would compile my comments instead of the code I wrote, but then I suppose I'd be working in COBOL.

Greg


Mark Webb-Johnson via OvmsDev wrote:
Reminds me of the old way of doing *10


If you look in the OVMS v2 code (on that little 8bit PIC microcontroller), you’ll see lots of little kludges like this. Some for performance, and some to keep the calculation similar to other tiny MCUs in the car.

Regards, Mark.