| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.txt | 2014-01-03 | 627 Bytes | |
| main_bit.c | 2014-01-03 | 471 Bytes | |
| bit.o | 2014-01-03 | 3.2 kB | |
| bit.h | 2014-01-03 | 1.2 kB | |
| bit.c | 2014-01-03 | 1.8 kB | |
| Totals: 5 Items | 7.3 kB | 0 | |
Project :: LIB.GUA.C
Autore : Sergio Guastaferro
( labgua )
BIT OPERATION
- ctoi() : convert a char to int
- msb() : MSB bit
- lsb() : LSB bit
- print_bit() : printf in binary
- bit_one() : number of bit set to '1'
Example main_bit.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bit.c"
int main(int argc, char* argv[]){
printf("LIB.GUA.C -> BIT.h\n");
if( argc != 2 ){
printf("USAGE : %s <num>\n",argv[0]);
exit(EXIT_FAILURE);
}
int a;
a = ctoi(argv[1]);
print_bit(&a);
lsb(&a);
msb(&a);
bit_one(&a);
return 0;
}