Hum, my reply has been removed (or never posted), but I'll try again...
b = (1L << a) - 1;//a = 32
or
b = (1L << a) - 1;//a = 32
this still doesn't work
Here's my assembly code (made by my compiler, I don't know assembly myself), maybe you can see the problem here...
Code:
12: unsigned long a = 32;
00401068 mov dword ptr [ebp-4],20h
13: //signed long a = 0xffffffff;
14: unsigned long b;
15: b = ((long)2 << (long)a);
0040106F mov eax,2
00401074 mov ecx,dword ptr [ebp-4]
00401077 shl eax,cl
00401079 mov dword ptr [ebp-8],eax
Maybe the the compiler checks to see if the right operand of lshift is % 32 before it executes because if I do: 2 << a (with a = 32) it also gives 2 (instead of 0)
Joren