Skip to content

Commit

Permalink
Sparse fixes: truncation by cast
Browse files Browse the repository at this point in the history
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
  • Loading branch information
blueswir1 committed Mar 7, 2009
1 parent 511d2b1 commit 9e622b1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions bswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ 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;
}

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;
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hw/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,15 +1210,15 @@ static void ide_atapi_cmd_check_status(IDEState *s)
static inline void cpu_to_ube16(uint8_t *buf, int val)
{
buf[0] = val >> 8;
buf[1] = val;
buf[1] = val & 0xff;
}

static inline void cpu_to_ube32(uint8_t *buf, unsigned int val)
{
buf[0] = val >> 24;
buf[1] = val >> 16;
buf[2] = val >> 8;
buf[3] = val;
buf[3] = val & 0xff;
}

static inline int ube16_to_cpu(const uint8_t *buf)
Expand Down
48 changes: 24 additions & 24 deletions hw/vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,33 @@

/* force some bits to zero */
const uint8_t sr_mask[8] = {
(uint8_t)~0xfc,
(uint8_t)~0xc2,
(uint8_t)~0xf0,
(uint8_t)~0xc0,
(uint8_t)~0xf1,
(uint8_t)~0xff,
(uint8_t)~0xff,
(uint8_t)~0x00,
0x03,
0x3d,
0x0f,
0x3f,
0x0e,
0x00,
0x00,
0xff,
};

const uint8_t gr_mask[16] = {
(uint8_t)~0xf0, /* 0x00 */
(uint8_t)~0xf0, /* 0x01 */
(uint8_t)~0xf0, /* 0x02 */
(uint8_t)~0xe0, /* 0x03 */
(uint8_t)~0xfc, /* 0x04 */
(uint8_t)~0x84, /* 0x05 */
(uint8_t)~0xf0, /* 0x06 */
(uint8_t)~0xf0, /* 0x07 */
(uint8_t)~0x00, /* 0x08 */
(uint8_t)~0xff, /* 0x09 */
(uint8_t)~0xff, /* 0x0a */
(uint8_t)~0xff, /* 0x0b */
(uint8_t)~0xff, /* 0x0c */
(uint8_t)~0xff, /* 0x0d */
(uint8_t)~0xff, /* 0x0e */
(uint8_t)~0xff, /* 0x0f */
0x0f, /* 0x00 */
0x0f, /* 0x01 */
0x0f, /* 0x02 */
0x1f, /* 0x03 */
0x03, /* 0x04 */
0x7b, /* 0x05 */
0x0f, /* 0x06 */
0x0f, /* 0x07 */
0xff, /* 0x08 */
0x00, /* 0x09 */
0x00, /* 0x0a */
0x00, /* 0x0b */
0x00, /* 0x0c */
0x00, /* 0x0d */
0x00, /* 0x0e */
0x00, /* 0x0f */
};

#define cbswap_32(__x) \
Expand Down
2 changes: 1 addition & 1 deletion tcg/x86_64/tcg-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static inline void tcg_out_opc(TCGContext *s, int opc, int r, int rm, int x)
}
if (opc & P_EXT)
tcg_out8(s, 0x0f);
tcg_out8(s, opc);
tcg_out8(s, opc & 0xff);
}

static inline void tcg_out_modrm(TCGContext *s, int opc, int r, int rm)
Expand Down

0 comments on commit 9e622b1

Please sign in to comment.