www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/03/21:43:29

Date: Wed, 3 Feb 1999 21:42:52 -0500 (EST)
From: Daniel Reed <djr AT narnia DOT n DOT ml DOT org>
To: djgpp AT delorie DOT com
Subject: Re: Re[2]: what is wrong with this?
In-Reply-To: <Pine.LNX.4.05.9902032034410.31847-100000@narnia.n.ml.org>
Message-ID: <Pine.LNX.4.05.9902032141230.31847-100000@narnia.n.ml.org>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Wed, 3 Feb 1999, Daniel Reed wrote:
) On Wed, 3 Feb 1999, anarko wrote:
) ) RBIT(c,b)    resets bit 'b' in char c
) To turn the b bit in byte c off, use:
) #define RBIT(c,b)	((c) &= ~(b))
Okay, I'm dumb. In my RBIT(), you specify the bit to turn off via its
value, not by its position.
#define RBIT(c,b)	((c) &= ~(1 << b))
should turn off bits by position.

) To turn the b bit in byte c on, use:
) #define SBIT(c,b)	((c) |= (b))
#define SBIT(c,b)	((c) |= (1 << b))

-- 
Daniel Reed <n AT ml DOT org>
I personally think we developed language because of our deep inner need to complain. -- Jane Wagner

- Raw text -


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