define ATOMIC_RELAXED = 0 define ATOMIC_CONSUME = 1 define ATOMIC_ACQUIRE = 2 define ATOMIC_RELEASE = 3 define ATOMIC_ACQ_REL = 4 define ATOMIC_SEQ_CST = 5 def __atomic_test_and_set(ptr: uint64*, order: int) -> bool: result: uint8 = 1 __asm__(f"""mov al, 1 xchg byte ptr [{asminp(ptr, ASM_DESCR.REG_ANY)}], al mov $0, al""", out = [asmout(result, ASM_DESCR.OUTPUT_REG)], op = [ASM_DESCR.CLOBBER_MEMORY, ASM_DESCR.CLOBBER_RAX]) return bool(result) def __atomic_clear(ptr: uint64*, order: int): __asm__(f"""mov byte ptr [{asminp(ptr, ASM_DESCR.REG_ANY)}], 0""", inp = [asminp(ptr, ASM_DESCR.REG_ANY)], op = [ASM_DESCR.CLOBBER_MEMORY]) def __atomic_thread_fence(order: int): __asm__("mfence", op=[ASM_DESCR.CLOBBER_MEMORY]) def __atomic_signal_fence(order: int): pass def __atomic_always_lock_free(size: sizet, ptr: rawptr) -> bool: return True def __atomic_is_lock_free(size: sizet, ptr: rawptr) -> bool: return True