MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / timestamp_diff

Function timestamp_diff

core/schedule.c:55–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55static inline uint64_t timestamp_diff(uint64_t a, uint64_t b) {
56#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86)
57 /* Avoid branchy codegen on 32-bit MSVC */
58 union {
59 struct {
60 uint32_t low;
61 uint32_t high;
62 };
63 uint64_t value;
64 } u;
65 bool borrow = _subborrow_u32(0, (uint32_t)a, (uint32_t)b, &u.low);
66 if (_subborrow_u32(borrow, (uint32_t)(a >> 32), (uint32_t)(b >> 32), &u.high)) {
67 u.low = u.high = 0;
68 }
69 return u.value;
70#else
71 return a < b ? 0 : a - b;
72#endif
73}
74
75static inline uint32_t floor_log2(uint32_t value) {
76 if (value == 0) {

Callers 4

sched_cycles_remainingFunction · 0.85
sched_ticks_remainingFunction · 0.85
sched_secondFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected