common/fp/util: Make ProcessNaN utility functions constexpr

Nothing in particular prevents these from being constexpr. Do so to make
them consistent with the bulk of other functions in this header that are
constexpr.
This commit is contained in:
Lioncash 2019-05-04 21:20:39 -04:00 committed by MerryMage
parent 6b9a40bdc4
commit 05b330906e

View file

@ -53,7 +53,7 @@ constexpr bool IsNaN(FPT value) {
/// Given a single argument, return the NaN value which would be returned by an ARM processor. /// Given a single argument, return the NaN value which would be returned by an ARM processor.
/// If the argument isn't a NaN, returns std::nullopt. /// If the argument isn't a NaN, returns std::nullopt.
template<typename FPT> template<typename FPT>
inline std::optional<FPT> ProcessNaNs(FPT a) { constexpr std::optional<FPT> ProcessNaNs(FPT a) {
if (IsSNaN(a)) { if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb; return a | FPInfo<FPT>::mantissa_msb;
} else if (IsQNaN(a)) { } else if (IsQNaN(a)) {
@ -65,7 +65,7 @@ inline std::optional<FPT> ProcessNaNs(FPT a) {
/// Given a pair of arguments, return the NaN value which would be returned by an ARM processor. /// Given a pair of arguments, return the NaN value which would be returned by an ARM processor.
/// If neither argument is a NaN, returns std::nullopt. /// If neither argument is a NaN, returns std::nullopt.
template<typename FPT> template<typename FPT>
inline std::optional<FPT> ProcessNaNs(FPT a, FPT b) { constexpr std::optional<FPT> ProcessNaNs(FPT a, FPT b) {
if (IsSNaN(a)) { if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb; return a | FPInfo<FPT>::mantissa_msb;
} else if (IsSNaN(b)) { } else if (IsSNaN(b)) {
@ -81,7 +81,7 @@ inline std::optional<FPT> ProcessNaNs(FPT a, FPT b) {
/// Given three arguments, return the NaN value which would be returned by an ARM processor. /// Given three arguments, return the NaN value which would be returned by an ARM processor.
/// If none of the arguments is a NaN, returns std::nullopt. /// If none of the arguments is a NaN, returns std::nullopt.
template<typename FPT> template<typename FPT>
inline std::optional<FPT> ProcessNaNs(FPT a, FPT b, FPT c) { constexpr std::optional<FPT> ProcessNaNs(FPT a, FPT b, FPT c) {
if (IsSNaN(a)) { if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb; return a | FPInfo<FPT>::mantissa_msb;
} else if (IsSNaN(b)) { } else if (IsSNaN(b)) {