I have
_int8 arr[0] = 0;
_int8 arr[1] = 0;
_int8 arr[2] = 14;
_int8 arr[3] = 16;
I need to convert it to one _int32 using as arr[0] as first part <..> and arr[3] as last.
In the end it should be
_int32 back = 3600;
Should I use bit shifts or smth like that to achieve this?
If you know the byte ordering (i.e. big endian or little endian, check it out on wikipedia), and the array is set up in the right order you can just do:
That’ll just interpret your array of 4 bytes as a buffer holding a single 32-bit integer. In your example though, I think you’ve got it set up for big endian and x86 isn’t. So you’d need to swap some bytes.
For instance:
or something like that.