Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/expr_pylike_eval.c
| Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | static bool parse_add_func(ExprParseState *state, eOpCode code, int args, void *funcptr) | ||||
| switch (code) { | switch (code) { | ||||
| case OPCODE_FUNC1: | case OPCODE_FUNC1: | ||||
| CHECK_ERROR(args == 1); | CHECK_ERROR(args == 1); | ||||
| if (jmp_gap >= 1 && prev_ops[-1].opcode == OPCODE_CONST) { | if (jmp_gap >= 1 && prev_ops[-1].opcode == OPCODE_CONST) { | ||||
| UnaryOpFunc func = funcptr; | UnaryOpFunc func = funcptr; | ||||
| double result = func(prev_ops[-1].arg.dval); | /* volatile because some compilers overly agressive optimize this call out. | ||||
| * see D6012 for details. */ | |||||
| volatile double result = func(prev_ops[-1].arg.dval); | |||||
brecht: Do it here as well, in case a small change somewhere triggers the same problem here. | |||||
| if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) { | if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) { | ||||
| prev_ops[-1].arg.dval = result; | prev_ops[-1].arg.dval = result; | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| case OPCODE_FUNC2: | case OPCODE_FUNC2: | ||||
| CHECK_ERROR(args == 2); | CHECK_ERROR(args == 2); | ||||
| if (jmp_gap >= 2 && prev_ops[-2].opcode == OPCODE_CONST && | if (jmp_gap >= 2 && prev_ops[-2].opcode == OPCODE_CONST && | ||||
| prev_ops[-1].opcode == OPCODE_CONST) { | prev_ops[-1].opcode == OPCODE_CONST) { | ||||
| BinaryOpFunc func = funcptr; | BinaryOpFunc func = funcptr; | ||||
| double result = func(prev_ops[-2].arg.dval, prev_ops[-1].arg.dval); | /* volatile because some compilers overly agressive optimize this call out. | ||||
| * see D6012 for details. */ | |||||
| volatile double result = func(prev_ops[-2].arg.dval, prev_ops[-1].arg.dval); | |||||
| if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) { | if (fetestexcept(FE_DIVBYZERO | FE_INVALID) == 0) { | ||||
| prev_ops[-2].arg.dval = result; | prev_ops[-2].arg.dval = result; | ||||
| state->ops_count--; | state->ops_count--; | ||||
| state->stack_ptr--; | state->stack_ptr--; | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 472 Lines • Show Last 20 Lines | |||||
Do it here as well, in case a small change somewhere triggers the same problem here.