Can someone please tell me what do these lines of code do
*(a++) = (int)((value >> 16) & 0xFF) ;
*(a++) = (int)((value >> 8) & 0xFF) ;
*(a++) = (int)((value & 0xFF)) ;
I understand that it checks the value, if it is much greater than 16 it converts it to type int and if it is much smaller than 8 does the same. But what does the
& 0xFF and *(a++) do?
It doesn’t check anything, it’s not like the
<<symbol in math which means “much smaller”. To break down this line:>>) shiftsvalue16 times to the right&) ands the result with0xFF, thereby discarding everything to the leftaapoint to some “next” element