Re: Need help on bit operations define
From: Felipe Magno de Almeida (felipe.almeida_at_ic.unicamp.br)
Date: 08/30/04
- Next message: name: "Re: Wrap thoughts"
- Previous message: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- In reply to: MakisGR: "Need help on bit operations define"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Aug 2004 05:03:28 GMT
MakisGR wrote:
> I'm having trouble understanding what the following define does. Can
> anyone provide some assistance?
>
> #define SetBits(bits,pos) (((bits)[(pos) >> 3]) |= (1 << ((pos) &
> 7)))
What it does is:
if 2^pos is less than 8, then sets bits[pos/8] with 2^pos, else
bits[pos/8] remains the same.
--
Felipe Magno de Almeida
Ciencia da Computacao - Unicamp
felipe.almeida@ic.unicamp.br - UIN: 2113442
Cause Rock and Roll can never die.
"if you want to learn something really well, teach it to a computer."
What is Communism?
Answer: "Communism is the doctrine of the conditions of the liberation
of the proletariat." (by Karl Marx)
--
comp.lang.c.moderated - moderation address: clcm@plethora.net
- Next message: name: "Re: Wrap thoughts"
- Previous message: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- In reply to: MakisGR: "Need help on bit operations define"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|