[Tinyos-help] tinyOS arithmetic question

John Griessen john at ecosensory.com
Wed Sep 5 09:16:08 PDT 2007


I am making some A2D code to  average some readings.
For a case of condensing a struct filled with readings:
uint16_t a
uint16_t b
uint16_t c
uint16_t d
a  = (a + b + c + d) >> 2
?

Will that compile efficiently?

for 12 bit Adc readings, this should lose no precision,
and not require declaring longs.

See any gotchas?

Thanks,

John Griessen
-- 
Ecosensory
tinyOS devel on:  ubuntu Linux;   tinyOS v2.0.2;   telosb ecosens1


More information about the Tinyos-help mailing list