(weird integer promotion, a unsigned char will be first tried to be promoted to "int" apparently,
so we need to cast it to avoid implicit behaviour)
fixes https://github.com/libexif/libexif/issues/20
if (!b) return 0;
switch (order) {
case EXIF_BYTE_ORDER_MOTOROLA:
- return ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]);
+ return (((uint32_t)b[0] << 24) | ((uint32_t)b[1] << 16) | ((uint32_t)b[2] << 8) | (uint32_t)b[3]);
case EXIF_BYTE_ORDER_INTEL:
- return ((b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]);
+ return (((uint32_t)b[3] << 24) | ((uint32_t)b[2] << 16) | ((uint32_t)b[1] << 8) | (uint32_t)b[0]);
}
/* Won't be reached */