Switch boost::optional to std::optional

This commit is contained in:
V.Kalyuzhny 2018-10-15 00:17:56 +03:00 committed by MerryMage
parent 85bc96a61c
commit 764a93bf5a
42 changed files with 137 additions and 125 deletions

View file

@ -6,7 +6,7 @@
#pragma once
#include <boost/optional.hpp>
#include <optional>
#include "common/assert.h"
#include "common/bit_util.h"
@ -75,14 +75,14 @@ public:
/// Get the stride of a vector when executing AArch32 VFP instructions.
/// This field has no function in AArch64 state.
boost::optional<size_t> Stride() const {
std::optional<size_t> Stride() const {
switch (Common::Bits<20, 21>(value)) {
case 0b00:
return 1;
case 0b11:
return 2;
default:
return boost::none;
return std::nullopt;
}
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <boost/optional.hpp>
#include <optional>
#include "common/bit_util.h"
#include "common/common_types.h"

View file

@ -4,7 +4,7 @@
* General Public License version 2 or any later version.
*/
#include <boost/optional.hpp>
#include <optional>
#include "common/assert.h"
#include "common/bit_util.h"
@ -41,7 +41,7 @@ template u32 FPProcessNaN<u32>(FPType type, u32 op, FPCR fpcr, FPSR& fpsr);
template u64 FPProcessNaN<u64>(FPType type, u64 op, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
std::optional<FPT> FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) {
if (type1 == FPType::SNaN) {
return FPProcessNaN<FPT>(type1, op1, fpcr, fpsr);
}
@ -54,14 +54,14 @@ boost::optional<FPT> FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2,
if (type2 == FPType::QNaN) {
return FPProcessNaN<FPT>(type2, op2, fpcr, fpsr);
}
return boost::none;
return std::nullopt;
}
template boost::optional<u32> FPProcessNaNs<u32>(FPType type1, FPType type2, u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr);
template boost::optional<u64> FPProcessNaNs<u64>(FPType type1, FPType type2, u64 op1, u64 op2, FPCR fpcr, FPSR& fpsr);
template std::optional<u32> FPProcessNaNs<u32>(FPType type1, FPType type2, u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr);
template std::optional<u64> FPProcessNaNs<u64>(FPType type1, FPType type2, u64 op1, u64 op2, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr) {
std::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr) {
if (type1 == FPType::SNaN) {
return FPProcessNaN<FPT>(type1, op1, fpcr, fpsr);
}
@ -80,10 +80,10 @@ boost::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FP
if (type3 == FPType::QNaN) {
return FPProcessNaN<FPT>(type3, op3, fpcr, fpsr);
}
return boost::none;
return std::nullopt;
}
template boost::optional<u32> FPProcessNaNs3<u32>(FPType type1, FPType type2, FPType type3, u32 op1, u32 op2, u32 op3, FPCR fpcr, FPSR& fpsr);
template boost::optional<u64> FPProcessNaNs3<u64>(FPType type1, FPType type2, FPType type3, u64 op1, u64 op2, u64 op3, FPCR fpcr, FPSR& fpsr);
template std::optional<u32> FPProcessNaNs3<u32>(FPType type1, FPType type2, FPType type3, u32 op1, u32 op2, u32 op3, FPCR fpcr, FPSR& fpsr);
template std::optional<u64> FPProcessNaNs3<u64>(FPType type1, FPType type2, FPType type3, u64 op1, u64 op2, u64 op3, FPCR fpcr, FPSR& fpsr);
} // namespace Dynarmic::FP

View file

@ -6,7 +6,7 @@
#pragma once
#include <boost/optional.hpp>
#include <optional>
namespace Dynarmic::FP {
@ -18,9 +18,9 @@ template<typename FPT>
FPT FPProcessNaN(FPType type, FPT op, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr);
std::optional<FPT> FPProcessNaNs(FPType type1, FPType type2, FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr);
template<typename FPT>
boost::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr);
std::optional<FPT> FPProcessNaNs3(FPType type1, FPType type2, FPType type3, FPT op1, FPT op2, FPT op3, FPCR fpcr, FPSR& fpsr);
} // namespace Dynarmic::FP

View file

@ -6,7 +6,7 @@
#pragma once
#include <boost/optional.hpp>
#include <optional>
#include "common/common_types.h"
#include "common/fp/fpcr.h"
@ -51,21 +51,21 @@ constexpr bool IsNaN(FPT value) {
}
/// Given a single argument, return the NaN value which would be returned by an ARM processor.
/// If the argument isn't a NaN, returns boost::none.
/// If the argument isn't a NaN, returns std::nullopt.
template<typename FPT>
inline boost::optional<FPT> ProcessNaNs(FPT a) {
inline std::optional<FPT> ProcessNaNs(FPT a) {
if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb;
} else if (IsQNaN(a)) {
return a;
}
return boost::none;
return std::nullopt;
}
/// Given a pair of arguments, return the NaN value which would be returned by an ARM processor.
/// If neither argument is a NaN, returns boost::none.
/// If neither argument is a NaN, returns std::nullopt.
template<typename FPT>
inline boost::optional<FPT> ProcessNaNs(FPT a, FPT b) {
inline std::optional<FPT> ProcessNaNs(FPT a, FPT b) {
if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb;
} else if (IsSNaN(b)) {
@ -75,13 +75,13 @@ inline boost::optional<FPT> ProcessNaNs(FPT a, FPT b) {
} else if (IsQNaN(b)) {
return b;
}
return boost::none;
return std::nullopt;
}
/// Given three arguments, return the NaN value which would be returned by an ARM processor.
/// If none of the arguments is a NaN, returns boost::none.
/// If none of the arguments is a NaN, returns std::nullopt.
template<typename FPT>
inline boost::optional<FPT> ProcessNaNs(FPT a, FPT b, FPT c) {
inline std::optional<FPT> ProcessNaNs(FPT a, FPT b, FPT c) {
if (IsSNaN(a)) {
return a | FPInfo<FPT>::mantissa_msb;
} else if (IsSNaN(b)) {
@ -95,7 +95,7 @@ inline boost::optional<FPT> ProcessNaNs(FPT a, FPT b, FPT c) {
} else if (IsQNaN(c)) {
return c;
}
return boost::none;
return std::nullopt;
}
} // namespace Dynarmic::FP