[Tinyos-devel] [Tinyos-help] problem in drip
Miklos Maroti
mmaroti at math.u-szeged.hu
Thu Jul 16 08:24:10 PDT 2009
Hi Qiu,
I was thinking about that, but since we divide a 16-bit number I
thought that it is fine. What is the scale value anyways? If it needs
to be fixed, then we should do it with an if, so the rval is 0 when
the period << (scale-1) overflows.
Miklos
On Thu, Jul 16, 2009 at 5:16 PM, qiu ying<qy.nwpu at gmail.com> wrote:
> I think the period in the following line also should be converted to
> uint32_t, when the period raise to 128, it will still overflow.
>
> line 262
> - rval = call Random.rand16() % (trickles[id].period << (scale - 1));
> + rval = call Random.rand16() % (((uint32_t)trickles[id].period) <<
> (scale - 1));
More information about the Tinyos-devel
mailing list