Quoting r. Grant Grundler <[EMAIL PROTECTED]>:
> Subject: Re: Re: [PATCH 1/2] (fixed) mthca: max_inline_data support
>
> On Tue, May 17, 2005 at 10:08:58AM -0700, Roland Dreier wrote:
> > Michael> Another problem is that fls may return 32 and you end up
> > Michael> with 1 << 32 which AFAIK has undefined behaviour in C.
>
> AFAIK, this is only true for ILP32 C compilers.
> LP64 C compiler must allow >32 values.
>
IFAIK it undefined if int is 32 bit. It seems that's the case with gcc
even on 64 bit systems. At least on x86_64 with gcc 3.3.3, int is 32 bit,
so:
~>cat x.c
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int foo(int arg, int shift)
{
return arg << shift;
}
int main(int argc, char **argv)
{
printf("1<<32 = %ld\n", foo(1, 32));
return 0;
}
~>gcc x.c
~>./a.out
1<<32 = 1
--
MST - Michael S. Tsirkin
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general