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. wegfaw+2n[view] [source] 2024-01-16 13:54:35
>>svanta+el
I hope they fix it. Thats quite a basic functional unit for it to be a footgun all on its own.
[go to top]