Use a static_cast instead of a reinterpert_cast so the code compiles
This commit is contained in:
Steve Singer
2016-02-10 22:25:06 -05:00
parent d1efde9124
commit 9ba0580721
+2 -2
View File
@@ -37,7 +37,7 @@ inline size_t Store16(uint8_t* dst, size_t offset, int x) {
*reinterpret_cast<uint16_t*>(dst + offset) = *reinterpret_cast<uint16_t*>(dst + offset) =
((x & 0xFF) << 8) | ((x & 0xFF00) >> 8); ((x & 0xFF) << 8) | ((x & 0xFF00) >> 8);
#elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) #elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
*reinterpret_cast<uint16_t*>(dst + offset) = reinterpret_cast<uint16_t>(x); *reinterpret_cast<uint16_t*>(dst + offset) = static_cast<uint16_t>(x);
#else #else
dst[offset] = x >> 8; dst[offset] = x >> 8;
dst[offset + 1] = x; dst[offset + 1] = x;
@@ -59,7 +59,7 @@ inline void Store16(int val, size_t* offset, uint8_t* dst) {
*offset += 2; *offset += 2;
#elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) #elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
*reinterpret_cast<uint16_t*>(dst + *offset) = *reinterpret_cast<uint16_t*>(dst + *offset) =
reinterpret_cast<uint16_t>(val); static_cast<uint16_t>(val);
*offset += 2; *offset += 2;
#else #else
dst[(*offset)++] = val >> 8; dst[(*offset)++] = val >> 8;