mirror of
https://github.com/RawAccelOfficial/rawaccel.git
synced 2025-05-11 10:26:58 +02:00
inline lerp
This commit is contained in:
parent
330f2f4c2a
commit
e1397f3edb
2 changed files with 10 additions and 9 deletions
|
@ -32,6 +32,16 @@ namespace rawaccel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__forceinline
|
||||||
|
constexpr double lerp(double a, double b, double t)
|
||||||
|
{
|
||||||
|
double x = a + t * (b - a);
|
||||||
|
if ((t > 1) == (a < b)) {
|
||||||
|
return maxsd(x, b);
|
||||||
|
}
|
||||||
|
return minsd(x, b);
|
||||||
|
}
|
||||||
|
|
||||||
struct lookup {
|
struct lookup {
|
||||||
enum { capacity = LUT_POINTS_CAPACITY };
|
enum { capacity = LUT_POINTS_CAPACITY };
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,6 @@ namespace rawaccel {
|
||||||
return (v < lo) ? lo : (hi < v) ? hi : v;
|
return (v < lo) ? lo : (hi < v) ? hi : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr double lerp(double a, double b, double t)
|
|
||||||
{
|
|
||||||
double x = a + t * (b - a);
|
|
||||||
if ((t > 1) == (a < b)) {
|
|
||||||
return maxsd(x, b);
|
|
||||||
}
|
|
||||||
return minsd(x, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the unbiased exponent of x if x is normal
|
// returns the unbiased exponent of x if x is normal
|
||||||
inline int ilogb(double x)
|
inline int ilogb(double x)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue