1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/* Public domain. */ #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #pragma redefine_extname __atomic_is_lock_free_c __atomic_is_lock_free bool __atomic_is_lock_free_c(size_t size, void *ptr) { switch (size) { case 1: return true; case 2: return (((uintptr_t)ptr & 1) == 0); case 4: return (((uintptr_t)ptr & 3) == 0); } return false; }