diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-17 02:32:05 +0200 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-17 22:49:23 +0200 |
commit | 137f8a58a8f2a6c356ef00e5371ff144c8a89fb0 (patch) | |
tree | 26381e38c6b0fb3ae17e3a7a05b2229bf996d9ee /core/variant.h | |
parent | 7655587efbb209703efc15b07667ee80de23bf5d (diff) |
Move Variant::evaluate() switch to computed goto
In an effort to make GDScript a little faster replace the double
switch() with a computed goto on compilers that set __GNUC__. For
compilers that don't support computed goto it will fall back to regular
switch/case statements.
In addition disable using boolean values in a mathematical context. Now
boolean values can only be compared with other booleans. Booleans will
also no longer be coerced to integers.
This PR replaces #11308 and fixes #11291
Diffstat (limited to 'core/variant.h')
-rw-r--r-- | core/variant.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/variant.h b/core/variant.h index e77e2e93c4..edc86dedd4 100644 --- a/core/variant.h +++ b/core/variant.h @@ -70,6 +70,7 @@ typedef PoolVector<Color> PoolColorArray; class Variant { public: + // If this changes the table in variant_op must be updated enum Type { NIL, @@ -288,6 +289,7 @@ public: Variant(const IP_Address &p_address); + // If this changes the table in variant_op must be updated enum Operator { //comparation @@ -299,7 +301,7 @@ public: OP_GREATER_EQUAL, //mathematic OP_ADD, - OP_SUBSTRACT, + OP_SUBTRACT, OP_MULTIPLY, OP_DIVIDE, OP_NEGATE, |