Skip to content

Commit

Permalink
Fix 8 bytes atomics when it is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
OdnetninI committed Sep 16, 2023
1 parent c67a003 commit 5533e45
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/std/atomic.c3
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,14 @@ fn CInt __atomic_compare_exchange(CInt size, any* ptr, any* expected, any* desir
int de = *(int*)desired;
if (ex == @__atomic_compare_exchange_ordering_success(pt, ex, de, success, failure)) return 1;
case 8:
long* pt = (long*)ptr;
long ex = *(long*)expected;
long de = *(long*)desired;
if (ex == @__atomic_compare_exchange_ordering_success(pt, ex, de, success, failure)) return 1;
$if iptr.sizeof >= 8:
long* pt = (long*)ptr;
long ex = *(long*)expected;
long de = *(long*)desired;
if (ex == @__atomic_compare_exchange_ordering_success(pt, ex, de, success, failure)) return 1;
$else
nextcase;
$endif
default:
assert(false, "Unsuported size (%d) for atomic_compare_exchange", size);
}
Expand Down

0 comments on commit 5533e45

Please sign in to comment.