[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <472F8B0E.40408@o2.pl>
Date: Mon, 05 Nov 2007 22:28:46 +0100
From: Jarek Poplawski <jarkao2@...pl>
To: Jarek Poplawski <jarkao2@...pl>
CC: Radu Rendec <radu.rendec@...s.ro>, hadi@...erus.ca,
netdev@...r.kernel.org
Subject: Re: Endianness problem with u32 classifier hash masks
Jarek Poplawski wrote, On 11/05/2007 10:06 PM:
> Radu Rendec wrote, On 11/05/2007 06:31 PM:
...
>> Jarek, because I have to test anyway, I'll include ffs(mask) in my patch
>> and have it tested too.
>
>
> Thanks! But, I did it wrong: + 1 is unnecessary. And since, ffs() checks
> for 0 anyway, this should be simpler:
>
> - {
> - u8 i = 0;
> - u32 mask = s->hmask;
> - if (mask) {
> - while (!(mask & 1)) {
> - i++;
> - mask>>=1;
> - }
> - }
> - n->fshift = i;
> + n->fshift = ffs(s->hmask);
> - }
>
> Plus maybe (u8) cast on warnings...
>
> On the other hand, only now I see here is some hack (or bug) with this
> u8, so ffs() would mean a change here. I definitely need to rethink this.
> So, it's probably better to make and test this ffs() patch separately
> (2 parts).
Sorry, I'm only sleeping... u8 is fine of course, and it could be 1 part
as well, or as you like!
Jarek P.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists