mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
time: Remove overflow error checking (currently breaks ADO builds).
This commit is contained in:
parent
a4e840181c
commit
361285add9
2 changed files with 2 additions and 18 deletions
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/safe_numerics/safe_integer.hpp>
|
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/uuid.h"
|
#include "common/uuid.h"
|
||||||
|
@ -26,13 +24,7 @@ struct SteadyClockTimePoint {
|
||||||
return ERROR_TIME_MISMATCH;
|
return ERROR_TIME_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boost::safe_numerics::safe<s64> this_time_point{time_point};
|
span = other.time_point - time_point;
|
||||||
const boost::safe_numerics::safe<s64> other_time_point{other.time_point};
|
|
||||||
try {
|
|
||||||
span = other_time_point - this_time_point;
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
return ERROR_OVERFLOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#include <boost/safe_numerics/safe_integer.hpp>
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/file_sys/content_archive.h"
|
#include "core/file_sys/content_archive.h"
|
||||||
|
@ -77,13 +75,7 @@ struct CalendarTimeInternal {
|
||||||
|
|
||||||
template <typename TResult, typename TOperand>
|
template <typename TResult, typename TOperand>
|
||||||
static bool SafeAdd(TResult& result, TOperand op) {
|
static bool SafeAdd(TResult& result, TOperand op) {
|
||||||
const boost::safe_numerics::safe<TResult> safe_result{result};
|
result = result + op;
|
||||||
const boost::safe_numerics::safe<TOperand> safe_op{op};
|
|
||||||
try {
|
|
||||||
result = safe_result + safe_op;
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
return {}; // Failed with undefined behavior
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue