MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / Fits32

Method Fits32

IntelPresentMon/CommonUtilities/log/ErrorCode.cpp:19–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 bool ErrorCode::HasSigned() const { return std::holds_alternative<int64_t>(integral_); }
18 bool ErrorCode::HasIntegral() const { return !std::holds_alternative<std::monostate>(integral_); }
19 bool ErrorCode::Fits32() const
20 {
21 if (auto u = AsUnsigned()) {
22 return *u <= std::numeric_limits<uint32_t>::max();
23 }
24 else if (auto u = AsSigned()) {
25 using i32 = std::numeric_limits<int32_t>;
26 return *u >= i32::min() && *u <= i32::max();
27 }
28 // doesn't really apply, but return true anyways
29 return true;
30 }
31 std::optional<uint64_t> ErrorCode::AsUnsigned() const {
32 return HasUnsigned() ?
33 std::optional{ std::get<uint64_t>(integral_) } : std::nullopt;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected