--- qemu/bswap.h 2018/04/24 16:50:52 1.1.1.3 +++ qemu/bswap.h 2018/04/24 17:21:02 1.1.1.4 @@ -151,7 +151,7 @@ static inline void cpu_to_le16wu(uint16_ { uint8_t *p1 = (uint8_t *)p; - p1[0] = v; + p1[0] = v & 0xff; p1[1] = v >> 8; } @@ -159,7 +159,7 @@ static inline void cpu_to_le32wu(uint32_ { uint8_t *p1 = (uint8_t *)p; - p1[0] = v; + p1[0] = v & 0xff; p1[1] = v >> 8; p1[2] = v >> 16; p1[3] = v >> 24; @@ -188,7 +188,7 @@ static inline void cpu_to_be16wu(uint16_ uint8_t *p1 = (uint8_t *)p; p1[0] = v >> 8; - p1[1] = v; + p1[1] = v & 0xff; } static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) @@ -198,7 +198,7 @@ static inline void cpu_to_be32wu(uint32_ p1[0] = v >> 24; p1[1] = v >> 16; p1[2] = v >> 8; - p1[3] = v; + p1[3] = v & 0xff; } #endif