[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] ARP ETHARP_TRY_HARD
From: |
Leon Woestenberg |
Subject: |
RE: [lwip-users] ARP ETHARP_TRY_HARD |
Date: |
Mon, 29 Nov 2004 11:56:45 +0100 |
Hello Paul,
On Mon, 2004-11-29 at 00:34, Paul Clarke wrote:
> Although the code is correct with its TRY_HARD from a code maintenance
> perspective it is a lot easier to see if there is an exit test
> for no empty slot and !flags & ETHARP_TRY_HARD.
>
OK, for that reason I have re-arranged the code a bit. It also speeds up
the case where ETHARP_TRY_HARD is not set.
> The following code can then remove the TRY_HARD case also making
> it easier to understand.
>
> example
>
> for (i = 0; i<ARP_TABLE_SIZE; i++){}
> // at exit i is either an empty slot or ARP_TABLE_SIZE
>
> if ( i== ARP_TABLE_SIZE && !flags & ETHARP_TRY_HARD)
> {
> return ERR_ARG; // could not find an empty slot
> }
!flags & ETHARP_TRY_HARD looks dangerously wrong to me,
! taking precedence over &, ! being boolean, & being
bit-wise 'and'. (or did I miss your intentions?)
You probably mean:
((flags & ETHARP_TRY_HARD) == 0)
or
(!(flags & ETHARP_TRY_HARD))
I have changed the code in CVS, please review. Thanks!
Regards,
Leon.
RE: [lwip-users] ARP ETHARP_TRY_HARD, Paul Clarke, 2004/11/28