mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
make float != 0 tests work on alpha for when the value is actually an integer
(works fine on intel, but on alpha the denormals either produce an exception or true zero: not quite desirable:)
This commit is contained in:
parent
9d0320cc89
commit
8d208ac3aa
1 changed files with 9 additions and 3 deletions
|
@ -248,6 +248,12 @@ PR_LeaveFunction (progs_t * pr)
|
||||||
#define OPB (pr->pr_globals[st->b])
|
#define OPB (pr->pr_globals[st->b])
|
||||||
#define OPC (pr->pr_globals[st->c])
|
#define OPC (pr->pr_globals[st->c])
|
||||||
|
|
||||||
|
/*
|
||||||
|
This gets around the problem of needing to test for -0.0 but denormals
|
||||||
|
causing exceptions (or wrong results for what we need) on the alpha.
|
||||||
|
*/
|
||||||
|
#define FNZ(x) ((x).integer_var && (x).integer_var != 0x80000000)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PR_ExecuteProgram
|
PR_ExecuteProgram
|
||||||
|
@ -369,13 +375,13 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
||||||
OPC.float_var = OPA.float_var < OPB.float_var;
|
OPC.float_var = OPA.float_var < OPB.float_var;
|
||||||
break;
|
break;
|
||||||
case OP_AND: // OPA and OPB have to be float for -0.0
|
case OP_AND: // OPA and OPB have to be float for -0.0
|
||||||
OPC.integer_var = OPA.float_var && OPB.float_var;
|
OPC.integer_var = FNZ (OPA) && FNZ (OPB);
|
||||||
break;
|
break;
|
||||||
case OP_OR: // OPA and OPB have to be float for -0.0
|
case OP_OR: // OPA and OPB have to be float for -0.0
|
||||||
OPC.integer_var = OPA.float_var || OPB.float_var;
|
OPC.integer_var = FNZ (OPA) || FNZ (OPB);
|
||||||
break;
|
break;
|
||||||
case OP_NOT_F:
|
case OP_NOT_F:
|
||||||
OPC.integer_var = !OPA.float_var;
|
OPC.integer_var = !FNZ (OPA);
|
||||||
break;
|
break;
|
||||||
case OP_NOT_V:
|
case OP_NOT_V:
|
||||||
OPC.integer_var = VectorIsZero (OPA.vector_var);
|
OPC.integer_var = VectorIsZero (OPA.vector_var);
|
||||||
|
|
Loading…
Reference in a new issue