I have four unsigned chars, each containing a byte, that I want to combine together to form a single int32_t, where the bytes come one after another.
unsigned char x1 = 0b11100111;
unsigned char x2 = 0b00010101;
unsigned char x3 = 0b10000110;
unsigned char x4 = 0b00001111;
With the four chars above the int32_t should have a binary representation of 0b11100111000101011000011000001111
.
How can this be done in c?