mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
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
This commit is contained in:
parent
7655587efb
commit
137f8a58a8
8 changed files with 1001 additions and 722 deletions
|
@ -1023,7 +1023,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
|||
case TK_OP_OR: op = Variant::OP_OR; break;
|
||||
case TK_OP_NOT: op = Variant::OP_NOT; break;
|
||||
case TK_OP_ADD: op = Variant::OP_ADD; break;
|
||||
case TK_OP_SUB: op = Variant::OP_SUBSTRACT; break;
|
||||
case TK_OP_SUB: op = Variant::OP_SUBTRACT; break;
|
||||
case TK_OP_MUL: op = Variant::OP_MULTIPLY; break;
|
||||
case TK_OP_DIV: op = Variant::OP_DIVIDE; break;
|
||||
case TK_OP_MOD: op = Variant::OP_MODULE; break;
|
||||
|
@ -1085,7 +1085,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
|
|||
case Variant::OP_MODULE: priority = 2; break;
|
||||
|
||||
case Variant::OP_ADD: priority = 3; break;
|
||||
case Variant::OP_SUBSTRACT: priority = 3; break;
|
||||
case Variant::OP_SUBTRACT: priority = 3; break;
|
||||
|
||||
case Variant::OP_SHIFT_LEFT: priority = 4; break;
|
||||
case Variant::OP_SHIFT_RIGHT: priority = 4; break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue