- added an optimization to FxBoolCast that it doesn't force the source value to a 0/1 integer if not explicitly needed. When doing comparisons we do not care about actual values, we only want to know if it is 0 or not.

- added the above for the 'if' condition. It works for integers, floats and pointers and will save 3 instructions if the condition is a non-boolean that can be implicitly casted to bool.
This commit is contained in:
Christoph Oelckers 2016-10-23 15:30:58 +02:00
commit da56e5908d
2 changed files with 48 additions and 25 deletions

View file

@ -457,10 +457,11 @@ public:
class FxBoolCast : public FxExpression
{
FxExpression *basex;
bool NeedValue;
public:
FxBoolCast(FxExpression *x);
FxBoolCast(FxExpression *x, bool needvalue = true);
~FxBoolCast();
FxExpression *Resolve(FCompileContext&);