c++, gcc3.2.2 and bitwise operations
Sebastian Huber
sebastian-huber@web.de
Wed Feb 19 11:56:00 GMT 2003
On Wednesday 19 February 2003 02:33, Chris Croswhite wrote:
> How can I play with the guts of a variable one bit at a time in c++? That
> is, I want to do something like this,
>
> long long val =0x4000000000000001;
> ((int*)(&val)[1]) &= 0x0;
>
> (this should set the first bit to zero).
> [...]
Hi,
the standard way to to this is:
val &= ~(0x1LL)
Bye
More information about the Gcc-help
mailing list