0
Help to understand the code. What's the output of the code?
lna_gain = tempint& ~0x07 what does this right side mean? what does the ~ do? if for example tempint = 32, what is the output of the code?
2 odpowiedzi
+ 1
A & ~B is like a filter for the bits of A. As an example, suppise A and B are chars, and A is defined to be 11011001, and B 00011111. Then ~B = 11100000, and if we AND them together we get
11011001
& 11100000
-------------------
11000000
This means that C = A & ~B is just A where if the same bit of B is set to 1, then the same bit on C is set to 0.
0
~ is a bitwise negation
https://code.sololearn.com/cYjh7XuMlzG7/?ref=app