| 57 | } |
| 58 | |
| 59 | static int64_t __inline hdr_atomic_add_fetch_64(volatile int64_t* field, int64_t value) |
| 60 | { |
| 61 | #if defined(_WIN64) |
| 62 | return _InterlockedExchangeAdd64(field, value) + value; |
| 63 | #else |
| 64 | int64_t comparand; |
| 65 | int64_t initial_value = *field; |
| 66 | do |
| 67 | { |
| 68 | comparand = initial_value; |
| 69 | initial_value = _InterlockedCompareExchange64(field, comparand + value, comparand); |
| 70 | } |
| 71 | while (comparand != initial_value); |
| 72 | |
| 73 | return initial_value + value; |
| 74 | #endif |
| 75 | } |
| 76 | |
| 77 | static bool __inline hdr_atomic_compare_exchange_64(volatile int64_t* field, int64_t* expected, int64_t desired) |
| 78 | { |
no outgoing calls
no test coverage detected