Spaces:
Runtime error
Runtime error
Download atomic.cpp from CVPR/LIVE: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/CVPR/LIVE/resolve/main/atomic.cpp
- Command line
-
hf download hf://spaces/CVPR/LIVE/atomic.cpp
-
curl -L -o atomic.cpp https://huggingface.co/spaces/CVPR/LIVE/resolve/main/atomic.cpp
770 Bytes
| //A hacky solution to get around the Ellipse include | |
| float win_atomic_add(float &target, float source) { | |
| union { int i; float f; } old_val; | |
| union { int i; float f; } new_val; | |
| do { | |
| old_val.f = target; | |
| new_val.f = old_val.f + (float)source; | |
| } while (InterlockedCompareExchange((LONG*)&target, (LONG)new_val.i, (LONG)old_val.i) != old_val.i); | |
| return old_val.f; | |
| } | |
| double win_atomic_add(double &target, double source) { | |
| union { int64_t i; double f; } old_val; | |
| union { int64_t i; double f; } new_val; | |
| do { | |
| old_val.f = target; | |
| new_val.f = old_val.f + (double)source; | |
| } while (InterlockedCompareExchange64((LONG64*)&target, (LONG64)new_val.i, (LONG64)old_val.i) != old_val.i); | |
| return old_val.f; | |
| } | |