From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29281 invoked by alias); 19 Feb 2003 11:56:40 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 29274 invoked from network); 19 Feb 2003 11:56:40 -0000 Received: from unknown (HELO smtp.web.de) (217.72.192.158) by 172.16.49.205 with SMTP; 19 Feb 2003 11:56:40 -0000 Received: from [129.187.26.170] (helo=mephisto) by smtp.web.de with asmtp (WEB.DE(Exim) 4.95 #31) id 18lSq7-0006dW-00 for gcc-help@gcc.gnu.org; Wed, 19 Feb 2003 12:56:39 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Sebastian Huber To: gcc-help@gcc.gnu.org Subject: Re: c++, gcc3.2.2 and bitwise operations Date: Wed, 19 Feb 2003 11:56:00 -0000 User-Agent: KMail/1.4.3 References: <43834.64.169.83.2.1045618399.squirrel@webmail01.get2chip.com> In-Reply-To: <43834.64.169.83.2.1045618399.squirrel@webmail01.get2chip.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200302191252.46259.sebastian-huber@web.de> X-SW-Source: 2003-02/txt/msg00169.txt.bz2 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 =3D0x4000000000000001; > ((int*)(&val)[1]) &=3D 0x0; > > (this should set the first bit to zero). > [...] Hi, the standard way to to this is: val &=3D ~(0x1LL) Bye