<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Wonder which is faster (or perhaps more compact?), using
INPUT<<2 and two adds, or INPUT<<3 and one add?<br>
<br>
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.<br>
<br>
Greg<br>
<br>
<br>
<div class="moz-cite-prefix">Mark Webb-Johnson via OvmsDev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:7AFC03F4-863C-4A30-9B0C-1EC5B85621ED@webb-johnson.net">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Reminds me of the old way of doing *10
<div><br>
</div>
<div>
<ul class="MailOutline">
<li>T1 = INPUT << 2</li>
<li>T2 = INPUT << 1</li>
<li>Result = T1 + T1 + T2</li>
</ul>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Regards, Mark.</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>