How to count a line
#define BIT_LEN 7 | |
float line_value(int line) { | |
int i; | |
int value = 0, count = 0; | |
for(i=0; i < BIT_LEN; ++i) { | |
int mask = (1 << (i)); | |
if((line & (mask)) == (mask)) { | |
value += i: | |
count++; | |
} | |
} | |
return value/count - BIT_LEN/2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment