Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Turn on the first n Bits in number

unsigned int set_bits(unsigned int n, unsigned int m) {
unsigned int mask = (1 << m) - 1;
return n | mask;
} 
 
PREVIOUS NEXT
Tagged: #Turn #Bits #number
ADD COMMENT
Topic
Name
3+8 =