Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. /*- Returns true if the left most (the most significant) bit of value is set and false otherwise*/
  2. bool IsLeftMostBitSet(unsigned int value)
  3. {
  4. //right shift value by 4 until it equals 8 or less
  5. //if it equals 8, the left most bit was set
  6. //if it was lower, the bit was not set
  7.  
  8. while (value > 8)
  9. {
  10. value = value >> 4;
  11. }
  12.  
  13. if (value == 8)
  14. return true;
  15. else
  16. return false;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement