1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[util] Implement fclamp for fp special cases

This commit is contained in:
Joshua Ashton 2019-04-20 21:24:02 +01:00 committed by Philip Rebohle
parent ec197b49f9
commit 9280818a57

View File

@ -1,5 +1,7 @@
#pragma once
#include <cmath>
namespace dxvk {
constexpr size_t CACHE_LINE_SIZE = 64;
@ -16,4 +18,12 @@ namespace dxvk {
return (what + to - 1) & ~(to - 1);
}
// Equivalent of std::clamp for use with floating point numbers
// Handles (-){INFINITY,NAN} cases.
// Will return min in cases of NAN, etc.
inline float fclamp(float value, float min, float max) {
return std::fmin(
std::fmax(value, min), max);
}
}