This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++, gcc3.2.2 and bitwise operations


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).  This worked with gcc 2.95.x, but I
understand now that the casting (&val)[1] (to an array) is "undefined" and
therefore not predictible.

Could anyone give me hand?

TIA,
Chris



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]