It assigns tempValue
the value in input2[0]
shifted to the left by 8 bits.
Here is a link about bit shifting in C: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/bitshift.html
Вопрос
tempValue = input2[0] << 8;
I can't figure out what the <<
does in this line of code. What is this used for?
Решение
It assigns tempValue
the value in input2[0]
shifted to the left by 8 bits.
Here is a link about bit shifting in C: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/bitshift.html
Другие советы
You can google Bitwise Operation for many information.
In your case, input2[0] being Left shift(<<) for 8 bits, which is * (2^8).
So, equivalent tempValue = input2[0] * (2^8) ;