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 [[nodiscard]]
constexpr EmuTime operator+(
const EmuDuration& r)
const
41 {
return EmuTime(time + r.time); }
42 [[nodiscard]]
constexpr EmuTime
operator-(
const EmuDuration& r)
const
43 { assert(time >= r.time);
44 return EmuTime(time - r.time); }
46 { time += d.time;
return *
this; }
48 { assert(time >= d.time);
49 time -= d.time;
return *
this; }
50 [[nodiscard]]
constexpr friend EmuDuration
operator-(
const EmuTime& l,
const EmuTime& r)
51 { assert(l.time >= r.time);
52 return EmuDuration(l.time - r.time); }
54 [[nodiscard]]
static constexpr EmuTime zero()
56 return EmuTime(uint64_t(0));
58 [[nodiscard]]
static constexpr EmuTime infinity()
60 return EmuTime(std::numeric_limits<uint64_t>::max());
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;
83template<>
struct SerializeAsMemcpy<EmuTime> : std::true_type {};
const EmuDuration & param
constexpr matMxN< M, N, T > operator-(const matMxN< M, N, T > &A)
This file implemented 3 utility functions:
std::ostream & operator<<(std::ostream &os, EnumTypeName< CacheLineCounters >)
void serialize(Archive &ar, T &t, unsigned version)