diff options
author | Wim Taymans <wtaymans@redhat.com> | 2015-08-19 09:53:45 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2016-03-07 10:33:29 +0100 |
commit | 54876b8d4c3ed2b07a52e17df247cb3043efb60d (patch) | |
tree | 4396b730b725570fd2e54be5cdd7c603245f37c4 | |
parent | c1f839f9303df00d89924f705f35959188af752d (diff) |
orc-c: improve clamp
-rw-r--r-- | orc/c/orc-c.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/orc/c/orc-c.c b/orc/c/orc-c.c index 21c60bf..8fbcbbb 100644 --- a/orc/c/orc-c.c +++ b/orc/c/orc-c.c @@ -261,7 +261,7 @@ emit_c_convfi (OrcCCompiler *c, OrcCInsn *insn, OrcBuffer *buffer) while (size > 0) { res += orc_buffer_append_printf (buffer, - " CONVFI (%d, _t%dp, %d, _t%dp, %d);\n", bits, insn->id, argbits, insn->arg[0], i); + " ORC_CONVFI (%d, _t%dp, %d, _t%dp, %d);\n", bits, insn->id, argbits, insn->arg[0], i); size -= bits; i++; } @@ -1040,7 +1040,7 @@ orc_c_get_asm_preamble (void) { return "\n" "/* begin Orc C target preamble */\n" - "#define ORC_CLAMP(a,min,max) ((a) <= (min) ? (min) : (a) >= (max) ? (max) : (a))\n" + "#define ORC_CLAMP(a,min,max) ((a) < (min) ? (min) : (a) > (max) ? (max) : (a))\n" "#define ORC_U8(v,idx) (((orc_uint8 *)(v))[idx])\n" "#define ORC_S8(v,idx) (((orc_int8 *)(v))[idx])\n" "#define ORC_U16(v,idx) (((orc_uint16 *)(v))[idx])\n" @@ -1061,8 +1061,9 @@ orc_c_get_asm_preamble (void) "#define ORC_MAX_S32 2147483647\n" "#define ORC_MIN_S32F -2147483648.0f\n" "#define ORC_MAX_S32F 2147483647.0f\n" - "#define CONVFI(ns,ip,s,fp,idx) \\\n" - " ORC_S ##ns (ip, idx) = ORC_CLAMP (ORC_F ##s (fp, idx), ORC_MIN_S ##ns## F, ORC_MAX_S ##ns## F)\n" + "#define ORC_CLAMPF(a,min,max) ((a) <= (min) ? (min) : (a) >= (max) ? (max) : (a))\n" + "#define ORC_CONVFI(ns,ip,s,fp,idx) \\\n" + " ORC_S ##ns (ip, idx) = ORC_CLAMPF (ORC_F ##s (fp, idx), ORC_MIN_S ##ns## F, ORC_MAX_S ##ns## F)\n" "#ifndef ORC_RESTRICT\n" "#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n" "#define ORC_RESTRICT restrict\n" |