mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Use std::llround in MapFloat
I don't see why not.
This commit is contained in:
parent
22197c09a3
commit
73dfcc15a5
@ -206,9 +206,9 @@ public:
|
|||||||
static_assert(std::is_integral<T>(), "T is only sane for int types.");
|
static_assert(std::is_integral<T>(), "T is only sane for int types.");
|
||||||
static_assert(std::is_floating_point<F>(), "F is only sane for float types.");
|
static_assert(std::is_floating_point<F>(), "F is only sane for float types.");
|
||||||
|
|
||||||
static_assert(std::numeric_limits<long>::min() <= std::numeric_limits<T>::min() &&
|
static_assert(std::numeric_limits<long long>::min() <= std::numeric_limits<T>::min() &&
|
||||||
std::numeric_limits<long>::max() >= std::numeric_limits<T>::max(),
|
std::numeric_limits<long long>::max() >= std::numeric_limits<T>::max(),
|
||||||
"long is not a superset of T. use of std::lround is not sane.");
|
"long long is not a superset of T. use of std::llround is not sane.");
|
||||||
|
|
||||||
// Here we round when converting from float to int.
|
// Here we round when converting from float to int.
|
||||||
// After applying our deadzone, resizing, and reshaping math
|
// After applying our deadzone, resizing, and reshaping math
|
||||||
@ -216,9 +216,9 @@ public:
|
|||||||
// Casting would round down but rounding will yield our "zero_value".
|
// Casting would round down but rounding will yield our "zero_value".
|
||||||
|
|
||||||
if (input_value > 0)
|
if (input_value > 0)
|
||||||
return T(std::lround((pos_1_value - zero_value) * input_value + zero_value));
|
return T(std::llround((pos_1_value - zero_value) * input_value + zero_value));
|
||||||
else
|
else
|
||||||
return T(std::lround((zero_value - neg_1_value) * input_value + zero_value));
|
return T(std::llround((zero_value - neg_1_value) * input_value + zero_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user