News Score: Score the News, Sort the News, Rewrite the Headlines

std::clamp still generates less efficient assembly than std::min(max, std::max(min, v)) on GCC and Clang

I originally wrote this blog post in 2019 (or maybe 2018 - my timestamps say that it was written before 1 May 2019). Recently I decided to revisit my old blog and found that std::clamp still generates less efficient assembly than std::min(max, std::max(min, v)) even on the latest versions of GCC (13.2) and Clang (17.0.1). Here’s my old blog post: Contents: Ternary Using intermediate values using std::min and std::max Using std::clamp Let’s say you want to clamp a value v between 2 values, min an...

Read more at 1f6042.blogspot.com

© News Score  score the news, sort the news, rewrite the headlines