15 template<
typename T,
bool C = sizeof(
void*) < 8> struct EmuTime_param_impl;
16 template<
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; }
20 template<
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
bool operator== (
const EmuTime&)
const =
default;
37 [[nodiscard]] constexpr
auto operator<=>(
const EmuTime&)
const =
default;
41 {
return EmuTime(time + d.time); }
43 { assert(time >= d.time);
44 return EmuTime(time - d.time); }
46 { time += d.time;
return *
this; }
48 { assert(time >= d.time);
49 time -= d.time;
return *
this; }
50 [[nodiscard]] constexpr EmuDuration
operator-(EmuTime::param
e)
const
51 { assert(time >=
e.time);
52 return EmuDuration(time -
e.time); }
54 [[nodiscard]]
static constexpr EmuTime zero()
56 return EmuTime(uint64_t(0));
58 [[nodiscard]]
static constexpr EmuTime infinity()
63 template<
typename Archive>
66 ar.serialize(
"time", time);
71 constexpr
explicit EmuTime(uint64_t n) : time(n) {}
77 friend EmuTime_param_impl<EmuTime>;
78 friend std::ostream&
operator<<(std::ostream& os, EmuTime::param time);
80 template<
unsigned,
unsigned>
friend class Clock;
83 template<>
struct SerializeAsMemcpy<EmuTime> : std::true_type {};
const EmuDuration & param
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
This file implemented 3 utility functions:
bool operator==(const Event &x, const Event &y)
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)