Honghui (James) Chen 's Blog
Welcome
Monday, 12 March 2012
Classical Programming - 2 : check bit of unsigned integer (c++)
bool isOn(unsigned int val, int bitNo){
return (val>>bitNo)%2;
}
bool isOff(unsigned int val, int bitNo){
return !isOn(val, bitNo);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment