AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO

MathUtils.h: Investigate replace/remove Clamp() function in favour of C++17 std::clamp()

Open
#2,255 0 comments 0 reactions 0 assignees View on GitHub
Modernise (C++17)
Dominant language
C++
Stars
2.1k
Forks
503
PR merge metrics
No merged PRs in 30d

Description

As we are now C++17 or greater we should probably investigate replacing calls to Clamp() with std::clamp.

Care may need with both performance and behaviour of non-normals etc to ensure the behaviour remains unchanged - for example ordering of arguments when one of them is a Nan, handling of +0.0 vs -0.0 etc

https://en.cppreference.com/w/cpp/algorithm/clamp.html

At first glance our implementation appears to be directly substitutable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.