delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/05/01:32:39

Message-Id: <3.0.6.32.19990205012942.00835860@pop.netaddress.com>
X-Sender: pderbysh AT pop DOT netaddress DOT com
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Fri, 05 Feb 1999 01:29:42 -0500
To: djgpp AT delorie DOT com
From: Paul Derbyshire <pderbysh AT usa DOT net>
Subject: Re: Re[4]: what is wrong with this?
In-Reply-To: <9179.990205@flashback.net>
References: <3 DOT 0 DOT 6 DOT 32 DOT 19990203235100 DOT 008de100 AT pop DOT netaddress DOT com>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

At 04:18 AM 2/5/99 +0100, you wrote:
>thanks, but i need a flexible routine like the one i posted earlier,
>you said it was too complex, but it really lets you specify wich bit
>to set/reset :)

To set bit d of n:

n |= (1<<d);     1<<d == 00010000 (1 in pos. d).

To reset bit d of n:

n &= ~(1<<d); ~(1<<d) == 11101111 (0 in pos. d).

-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  |http://surf.to/pgd.net
_____________________ ____|________     Paul Derbyshire     pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019