I would change this: static constexpr uint8_t endianValues[4] = {0, 1, 2, 3}; To this: static const uint32_t value = HL_LITTLE_ENDIAN; // 0x03020100 static const uint8_t* endianValues = (uint8_t*)&value;