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

bit_clear, bit_test

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







bit_clear, bit_test
PostPosted: Tue Sep 22, 2009 5:16 am     Reply with quote

Where can i find the function definition of bit_set and bit_clear ?

O.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Sep 22, 2009 5:29 am     Reply with quote

There is no real 'function definition' for these functions, they map directly onto the machine assembly instructions 'BSF' and 'BCF'.
Wirgle
Guest







PostPosted: Tue Sep 22, 2009 5:39 am     Reply with quote

So, if i want to make my own... What should i do?
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Sep 22, 2009 8:38 am     Reply with quote

This is like saying ..
I hand you a bucket of water.
And you say but I want to make my own water.
Its done for you. Why would you re-invent the wheel?


that being said..
from the help file for bit test.
Quote:
Tests the specified bit (0-7,0-15 or 0-31) in the given variable. The least significant bit is 0. This function is much more efficient than, but otherwise the same as: ((var & (1<<bit)) != 0)

you can use something similar for bit set
Code:
var |= (1<<bit);

and bit clear
Code:
var &= ~(1<<bit);


But the built in way is what you should use.
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