Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language byte and plastic conversion, how to do it?
C language byte and plastic conversion, how to do it?
From high byte to low byte, input in turn (i.e. x1->; x2-& gt; x3->; x4)

x =((int)x 1 & lt; & lt24)+((int)x2 & lt; & lt 16)+((int)x3 & lt; & lt8)+((int)x4);

Write as a macro:

# Definition change (x 1, x2, x3, x4) ((int) x1< & lt24)+((int)x2 & lt; & lt 16)+((int)x3 & lt; & lt8) + ((int)x4)

Call:

x = change(x 1,x2,x3,x4);