aboutsummaryrefslogtreecommitdiff
path: root/bswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'bswap.h')
-rw-r--r--bswap.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/bswap.h b/bswap.h
index 63b81cc43b..1dd357eb9d 100644
--- a/bswap.h
+++ b/bswap.h
@@ -151,7 +151,7 @@ static inline void cpu_to_le16wu(uint16_t *p, uint16_t v)
{
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_t *p, uint32_t v)
{
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_t *p, uint16_t v)
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_t *p, uint32_t v)
p1[0] = v >> 24;
p1[1] = v >> 16;
p1[2] = v >> 8;
- p1[3] = v;
+ p1[3] = v & 0xff;
}
#endif