Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. // supposed to get first set bit.
  2.  
  3. // bitfield is 16 bits
  4. u16 value_catcher;
  5. for (i = 15; i > 0; i--) {
  6. value_catcher = bitfield << i;
  7. value_catcher >>= 15;
  8. if (value_catcher)
  9. return i;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement