// input, output, i, and k are uint16_t type
// It is assured that k is non-negative and "small enough"
// k = 4
// input = 0x3a44
output = 0;
for (i=k; i<16; i++){
if (input & 1<<i)
output = output | 1 <<(i-k);
}
so input = 0011 1010 0100 0100
with k = 4 or 0000 0000 0000 0100 the loop runs 12 times
I guess what is confusing me is how the if and output parts are working, I know the bitwise operators & and | and that left shift is <<..but I get lost with what the overall function of the loop is
It’s apparently intended to make the output equal to (16 bits of) the input, right-shifted 4 bits (or whatever the value assigned to K happens to be).