CP_Sucks's blog

By CP_Sucks, history, 3 years ago, In English

Given Number = n To check kth bit set or not To Do 1. int temp = 1<<(k-1) (if u assume LSB to be 1 then use k-1 otherwise if assume 0 use k) 2. AND temp with n 3. If result is non-zero then set otherwise not set.

 
 
 
 
  • Vote: I like it
  • -28
  • Vote: I do not like it