summaryrefslogtreecommitdiff
path: root/bswap.h
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 15:46:23 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 15:46:23 +0000
commit9e622b15a3fb4872a1424f2717dc956da18e473d (patch)
tree6be2b8de8eb5ab97128114bcae2c83e9f0825d70 /bswap.h
parent511d2b140f3ff2f80d14637cdc2f29743a2daa51 (diff)
Sparse fixes: truncation by cast
Fix Sparse warnings about constant truncation caused by cast git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6737 c046a42c-6fe2-441c-8c8c-71466251a162
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 63b81cc43..1dd357eb9 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