[En-Nut-Discussion] Suggested modification to nut\net\tcpsm.c again

Nathan Moore nategoose at gmail.com
Thu Nov 12 16:08:44 CET 2009


On Thu, Nov 12, 2009 at 7:39 AM, <ennut at thezachariasgroup.com> wrote:

>   I have heartache casting the 32 bit result from NutGetMillis() to
> uint16_t.
>   Doesn't it make more sense to define so_retran_time as u_long
> rather than u_short in sock_var.h ?
>

I suspect that this is done for AVR because RAM is more limited and doing
math
on a 32 bit value requires about twice the number of machine instructions as
on
a 16 bit value.
Best thing would be to use uint_fast16_t, I think.

Using this timeout value as a flag as well as a timing value still scares
me, though,
because everytime it is used or a place that uses it is changed there is a
chance
that someone will forget to |= 1 it.


Nathan



More information about the En-Nut-Discussion mailing list