zlacker

[return to "Std: Clamp generates less efficient assembly than std:min(max,std:max(min,v))"]
1. svanta+el[view] [source] 2024-01-16 13:42:56
>>x1f604+(OP)
I'm a heavy std::clamp user, but I'm considering replacing it with min+max because of the uncertainty about what will happen when lo > hi. On windows it triggers an assertion, while other platforms just do a min+max in one or the other order. Of course, this should never happen but can be difficult to guarantee when the limits are derived from user inputs.
◧◩
2. lifthr+zl[view] [source] 2024-01-16 13:44:40
>>svanta+el
Pretty sure that their behaviors on NaN arguments will also differ.
[go to top]