On Son, 2008-11-30 at 03:32 +0100, Markus Kittenberger wrote:
> On Sat, Nov 29, 2008 at 10:14 PM, Markus Kittenberger
> <Markus.Kittenberger@gmx.at> wrote:
>         i ended in ipcalc.c 
>         
>         121 if(olsr_cnf->ip_version == AF_INET) {
>         122  uint32_t netmask = ntohl(~0 << (32 - net->prefix_len));
>         123  rv = (ipaddr->v4.s_addr & netmask) ==
>         (net->prefix.v4.s_addr & netmask);
>         124 }
>         
> as you can`t shift a 32 bit wide type by 32 (which is of no big usage
> anyway (-;)

Obviously there is a "big usage";-)
Everything else is a question of definition (and one can define it).
But given the most simple implementation hardware - take the least
significant 5 bits and ignore the rest - it is to be expected.
Grrml.
Thanks for hunting that bug down BTW.

> e.g. if you code like following you end in an compiler warning 
> .
> netmask = netmask << 32;
> .
> warning: left shift count >= width of type

ACK.
I think I will make a sane inline function for this in src/ipcalc.h and
use that everywhere.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



