From dee17d020970e0a0ac99874899aa4bf406f918a5 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 14 Aug 2009 19:39:24 +0000 Subject: [PATCH] experimental change: do a float compare for OP_IF and OP_IFNOT, so negative zero float value counts as false. No other value in QC can have the bit pattern 0x80000000 as long as no int type is added. I have verified that the only false floats on x86_64 and i386 are 0 and 0x80000000. However, this may fail on other platforms! (but then, OR_F and others would also fail in some cases, as fteqcc also uses it for "float || entity"). When an "int" type is introduced, we'll need a new IF_I and IFNOT_I instruction as then this would REALLY have a bad impact. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9113 d7cf8633-e32d-0410-b094-e92efae38249 --- prvm_execprogram.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/prvm_execprogram.h b/prvm_execprogram.h index 17ea2fcc..19fc6bb3 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -238,7 +238,10 @@ //================== case OP_IFNOT: - if (!OPA->_int) + if (!OPA->_float) + // TODO add an "int-ifnot" + // although mostly unneeded, thanks to the only float being false being 0x0 and 0x80000000 (negative zero) + // and entity, string, field values can never have that value { prog->xfunction->profile += (st - startst); st += st->b - 1; // offset the s++ @@ -255,7 +258,10 @@ break; case OP_IF: - if (OPA->_int) + if (OPA->_float) + // TODO add an "int-if" + // although mostly unneeded, thanks to the only float being false being 0x0 and 0x80000000 (negative zero) + // and entity, string, field values can never have that value { prog->xfunction->profile += (st - startst); st += st->b - 1; // offset the s++ -- 2.39.2