I am using signed to unsigned byte(int8_t) cast to pack byts.
uint32_t(uint8_t(byte)) << n
This works using GCC on Intel Linux. Is that portable for other platforms/compilers, for example PowerPC?
is there a better way to do it? using bitset is not possible in my case.
I am using stdint via boost
If you are using
boost/cstdint.hppfrom the Boost Integer library, then yes, the typedefs are portable (cross-platform.) Theboost/cstdint.hppheader is meant to implement C99 stdint.h functionality in C++.From the Boost documentation: