balwinder open source@seneca
Thursday, 8 March 2012
Find the given Bit number in a integer value is ON or OFF
bool isOn(unsigned int val, int bitNo){
return ((val<<(32-bitNo))>>31);
}
bool isOff(unsigned int val, int bitNo){
return !((val<<(32-bitNo))>>31);
}
2 comments:
Anonymous
8 March 2012 at 22:21
Very smart thinking!! Nice!!
Reply
Delete
Replies
Balwinder Singh
8 March 2012 at 22:38
Thanks Deva!!
Delete
Replies
Reply
Reply
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Very smart thinking!! Nice!!
ReplyDeleteThanks Deva!!
Delete