// file: lecture_10/example_00.cc // // a simple function that doesn't do much // // system include files // #include "example.h" // function: my_function // // arguments: // long arg1: the first argument // long arg2: the second argument // // return: a bool indicating status // bool my_function(long argv1, long argv2) { // do some bnit-level stuff // unsigned char a = 5, b = 9; // a = 5(00000101), b = 9(00001001) fprintf(stdout, "a = %d, b = %d\n", a, b); fprintf(stdout, "a&b = %d\n", a&b); // The result is 00000001 fprintf(stdout, "a|b = %d\n", a|b); // The result is 00001101 fprintf(stdout, "a^b = %d\n", a^b); // The result is 00001100 fprintf(stdout, "~a = %d\n", a = ~a); // The result is 11111010 fprintf(stdout, "b<<1 = %d\n", b<<1); // The result is 00010010 fprintf(stdout, "b>>1 = %d\n", b>>1); // The result is 00000100 // exit gracefully // return true; }