CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Accessing Individual Bits of a Variable

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Amin



Joined: 19 Feb 2004
Posts: 15

View user's profile Send private message

Accessing Individual Bits of a Variable
PostPosted: Sat Feb 19, 2005 7:57 pm     Reply with quote

Hi
sorry for the newbiest question of all

how do I access a single bit in a variable ?
I searched but my keywords are too generic tpo pinpoint any good search results.

and is it faster to check if bit seven is 1 or to compared the value against 127?


Thanks
Amin
_________________
McMaster Solar Car Project
http://www.solarcar.mcmaster.ca
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

Re: Accessing Individual Bits of a Variable
PostPosted: Sat Feb 19, 2005 8:16 pm     Reply with quote

Amin wrote:
Hi
sorry for the newbiest question of all

how do I access a single bit in a variable ?
I searched but my keywords are too generic tpo pinpoint any good search results.

and is it faster to check if bit seven is 1 or to compared the value against 127?


Thanks
Amin


bit_test();, bit_set(); and bit_clear();.

Bit 7 will tell if your variable is equal or greater than 128.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group