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 support@ccsinfo.com

bit_test a constant

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



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

bit_test a constant
PostPosted: Fri Mar 09, 2012 2:17 am     Reply with quote

Hi,
Is there an easy way to bit_test a constant? the in-built bit_test function doesn't allow it.
Ttelmah



Joined: 11 Mar 2010
Posts: 19366

View user's profile Send private message

PostPosted: Fri Mar 09, 2012 2:48 am     Reply with quote

Seems totally pointless. After all a constant, is constant, so the bit test is always going to return the same value.....
You can always just use a simple '&' test.

#define constant_bit_test(X,Y) (X&(1<<Y)!=0)

Best Wishes
Will Reeve



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Fri Mar 09, 2012 3:45 am     Reply with quote

thanks, they are "variable" constants in a separate file which are calibration constants to each micro but change for each device (separate file for each product)! As the compiler knows where in program space it has stored them I thought it might allow bit_wise access to them with an inbuilt function.
Your neat code looks great. Thanks.
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