summaryrefslogtreecommitdiff
path: root/orc/orcprogram-c.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-04-25 20:42:02 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-04-25 20:48:09 +0200
commiteb41b5c3a7c57a8b8a26ffde36d52ef4716f6465 (patch)
treee66681bd07f9c151183e030715d6107e8cef75b9 /orc/orcprogram-c.c
parent2e779af8ea627b43f7ad7a1e9f611a9c6a877f53 (diff)
downloadorc-eb41b5c3a7c57a8b8a26ffde36d52ef4716f6465.tar.gz
orcprogram-c: Convert shifts in swap opcodes to operations on unsigned integers
Shifting into the sign bit is undefined, so let's stop doing that.
Diffstat (limited to 'orc/orcprogram-c.c')
-rw-r--r--orc/orcprogram-c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/orc/orcprogram-c.c b/orc/orcprogram-c.c
index e000fee..2afb0cf 100644
--- a/orc/orcprogram-c.c
+++ b/orc/orcprogram-c.c
@@ -126,8 +126,8 @@ orc_target_c_get_asm_preamble (void)
"#define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)\n"
"#define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)\n"
"#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)\n"
- "#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))\n"
- "#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))\n"
+ "#define ORC_SWAP_W(x) ((((x)&0xffU)<<8) | (((x)&0xff00U)>>8))\n"
+ "#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>24))\n"
"#define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))\n"
"#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))\n"
"#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))\n"
@@ -1410,7 +1410,7 @@ c_rule_swapwl (OrcCompiler *p, void *user, OrcInstruction *insn)
c_get_name_int (dest, p, insn, insn->dest_args[0]);
c_get_name_int (src, p, insn, insn->src_args[0]);
- ORC_ASM_CODE(p," %s = ((%s&0x0000ffff) << 16) | ((%s&0xffff0000) >> 16);\n",
+ ORC_ASM_CODE(p," %s = ((%s&0x0000ffffU) << 16) | ((%s&0xffff0000U) >> 16);\n",
dest, src, src);
}