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?

13th Apr 2018, 9:54 AM
Armin Windmill
Armin Windmill - avatar
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.
13th Apr 2018, 11:38 AM
Bebida Roja
Bebida Roja - avatar
13th Apr 2018, 10:11 AM
Alex
Alex - avatar