MCPcopy Create free account
hub / github.com/crosire/reshade / evaluate_constant_expression

Method evaluate_constant_expression

source/effect_expression.cpp:431–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431bool reshadefx::expression::evaluate_constant_expression(reshadefx::tokenid op)
432{
433 if (!is_constant)
434 return false;
435
436 switch (op)
437 {
438 case tokenid::exclaim:
439 for (unsigned int i = 0; i < type.components(); ++i)
440 constant.as_uint[i] = !constant.as_uint[i];
441 break;
442 case tokenid::minus:
443 if (type.is_floating_point())
444 for (unsigned int i = 0; i < type.components(); ++i)
445 constant.as_float[i] = -constant.as_float[i];
446 else
447 for (unsigned int i = 0; i < type.components(); ++i)
448 constant.as_int[i] = -constant.as_int[i];
449 break;
450 case tokenid::tilde:
451 for (unsigned int i = 0; i < type.components(); ++i)
452 constant.as_uint[i] = ~constant.as_uint[i];
453 break;
454 default:
455 // Unknown operator token, so nothing to do
456 break;
457 }
458
459 return true;
460}
461bool reshadefx::expression::evaluate_constant_expression(reshadefx::tokenid op, const reshadefx::constant &rhs)
462{
463 if (!is_constant)

Callers 2

Calls 3

componentsMethod · 0.80
is_floating_pointMethod · 0.80
is_signedMethod · 0.80

Tested by

no test coverage detected