 
 func bnr_atomic_ptr_load(_ target: bnr_atomic_ptr_t, _ order: bnr_atomic_memory_order_t) -> UnsafeRawPointer? {
     var result: UnsafeRawPointer?
-    DarwinAtomics.shared.load(CInt(MemoryLayout<UnsafeRawPointer>.size), target, &result, order)
+    DarwinAtomics.shared.load(MemoryLayout<UnsafeRawPointer>.size, target, &result, order)
     return result
 }
 
 func bnr_atomic_ptr_exchange(_ target: bnr_atomic_ptr_t, _ desired: UnsafeRawPointer?, _ order: bnr_atomic_memory_order_t) -> UnsafeRawPointer? {
     var new = desired
     var old: UnsafeRawPointer?
-    DarwinAtomics.shared.exchange(CInt(MemoryLayout<UnsafeRawPointer>.size), target, &new, &old, order)
+    DarwinAtomics.shared.exchange(MemoryLayout<UnsafeRawPointer>.size, target, &new, &old, order)
     return old
 }
 
 func bnr_atomic_ptr_compare_and_swap(_ target: bnr_atomic_ptr_t, _ expected: UnsafeRawPointer?, _ desired: UnsafeRawPointer?, _ order: bnr_atomic_memory_order_t) -> Bool {
     var expected = expected
     var desired = desired
-    return DarwinAtomics.shared.compareExchange(CInt(MemoryLayout<UnsafeRawPointer>.size), target, &expected, &desired, order, .relaxed) == 1
+    return DarwinAtomics.shared.compareExchange(MemoryLayout<UnsafeRawPointer>.size, target, &expected, &desired, order, .relaxed)
 }
 
 typealias bnr_atomic_flag = Bool


func bnr_atomic_flag_load(_ target: bnr_atomic_flag_t, _ order: bnr_atomic_memory_order_t) -> Bool {
    var result: Bool = false
    DarwinAtomics.shared.load(CInt(MemoryLayout<Bool>.size), target, &result, order)
    return result
}

func bnr_atomic_flag_test_and_set(_ target: bnr_atomic_flag_t, _ order: bnr_atomic_memory_order_t) -> Bool {
    var new = true
    var old = false
    DarwinAtomics.shared.exchange(CInt(MemoryLayout<Bool>.size), target, &new, &old, order)
    return old
}



func bnr_atomic_bitmask_test(_ target: bnr_atomic_bitmask_t, _ mask: UInt8, _ order: bnr_atomic_memory_order_t) -> Bool {
    var result: UInt8 = 0
    DarwinAtomics.shared.load(MemoryLayout<UInt8>.size, target, &result, order)
    return (result & mask) != 0
}
#endif
