Refers to the number of bits that can be processed or transmitted in parallel, or thenumber of bits used for single element in adata format. The term is often applied to thefollowing: microprocessor: indicates the width of theregisters. A 16-bit microprocessor can processdata and memory addresses that are representedby 16 bits. bus : indicates the …
Tag Archives: bit
Algorithms: bit manipulation
How to find out if nth bit of a number is set to 1?
#include <stdio.h> int main() { int val1 = 4; int val2 = 18; int mask = 1; /* mask <<= 4; */ mask = mask << 4; printf(“mask is %d\n”,mask); if ( val1 & mask ) { printf(“Bit 5 in val1 is set\n”); } if (val2 & mask ) { printf(“Bit 5 in val2 is …
Continue reading “How to find out if nth bit of a number is set to 1?”