| 53 | } |
| 54 | |
| 55 | static 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 | |
| 75 | static inline uint32_t floor_log2(uint32_t value) { |
| 76 | if (value == 0) { |
no outgoing calls
no test coverage detected