clamp an input value to [0,255]; NaN is turned into 0
| 4548 | |
| 4549 | // clamp an input value to [0,255]; NaN is turned into 0 |
| 4550 | float clamp255(float val) |
| 4551 | { |
| 4552 | if (val > 255.0f) |
| 4553 | val = 255.0f; |
| 4554 | else if (val > 0.0f) |
| 4555 | { |
| 4556 | // deliberately empty |
| 4557 | // switching the order of calculation here will fail to handle 0. |
| 4558 | } |
| 4559 | else |
| 4560 | val = 0.0f; |
| 4561 | |
| 4562 | return val; |
| 4563 | } |
| 4564 | |
| 4565 | // clamp an input value to [0,1]; Nan is turned into 0. |
| 4566 | float clamp01(float val) |
no outgoing calls
no test coverage detected