| 429 | } |
| 430 | |
| 431 | bool 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 | } |
| 461 | bool reshadefx::expression::evaluate_constant_expression(reshadefx::tokenid op, const reshadefx::constant &rhs) |
| 462 | { |
| 463 | if (!is_constant) |
no test coverage detected