matsstaff / stc1000p

Programmable thermostat firmware and arduino based uploader for the STC-1000 thermostat
GNU General Public License v3.0
261 stars 47 forks source link

optimize range checking of adfilter value in ad_to_temp() #77

Closed seanmcveigh closed 8 years ago

seanmcveigh commented 8 years ago

shaved 8 instructions out of the range checking. as long as FILTER_SHIFT is 3 or larger, this works, and there is a further optimization if it is 6.

note: I changed the range check from:

= 248 && <= 8 to = 248 && < 8

If you anticipate problems with that, feel free to reject.