15template<
typename T,
bool C = sizeof(
void*) < 8> struct EmuTime_param_impl;
16template<
typename T>
struct EmuTime_param_impl<T, true> {
17 using param =
const T&;
18 static param dummy() {
static constexpr auto e = T::zero();
return e; }
20template<
typename T>
struct EmuTime_param_impl<T, false> {
22 static param dummy() {
return T(); }
28 using param = EmuTime_param_impl<EmuTime>::param;
29 static param dummy() {
return EmuTime_param_impl<EmuTime>::dummy(); }
33 static constexpr EmuTime makeEmuTime(uint64_t u) {
return EmuTime(u); }
36 [[nodiscard]]
constexpr auto operator<=>(
const EmuTime&)
const =
default;
40 {
return EmuTime(time + d.time); }
42 { assert(time >= d.time);
43 return EmuTime(time - d.time); }
45 { time += d.time;
return *
this; }
47 { assert(time >= d.time);
48 time -= d.time;
return *
this; }
49 [[nodiscard]]
constexpr EmuDuration
operator-(EmuTime::param e)
const
50 { assert(time >=
e.time);
51 return EmuDuration(time -
e.time); }
53 [[nodiscard]]
static constexpr EmuTime zero()
55 return EmuTime(uint64_t(0));
57 [[nodiscard]]
static constexpr EmuTime infinity()
59 return EmuTime(std::numeric_limits<uint64_t>::max());
62 template<
typename Archive>
65 ar.serialize(
"time", time);
70 constexpr explicit EmuTime(uint64_t n) : time(n) {}
76 friend EmuTime_param_impl<EmuTime>;
77 friend std::ostream&
operator<<(std::ostream& os, EmuTime::param time);
79 template<
unsigned,
unsigned>
friend class Clock;
82template<>
struct SerializeAsMemcpy<EmuTime> : std::true_type {};
const EmuDuration & param
This file implemented 3 utility functions:
std::ostream & operator<<(std::ostream &os, EnumTypeName< CacheLineCounters >)
void serialize(Archive &ar, T &t, unsigned version)
constexpr uint128 operator-(const uint128 &a, const uint128 &b)
constexpr uint128 operator+(const uint128 &a, const uint128 &b)
constexpr auto operator<=>(const uint128 &a, const uint128 &b)