Skip to content

Commit

Permalink
fix compilation error for compare-and-swap on Real32.real array
Browse files Browse the repository at this point in the history
  • Loading branch information
shwestrick committed May 25, 2023
1 parent 09b59c9 commit 5a98337
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/c-chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ Real64 ArrayR64_cas(Real64* a, Word64 i, Real64 x, Real64 y) {
return *((Real64*)&result);
}

static inline
Real32 ArrayR32_cas(Real32* a, Word64 i, Real32 x, Real32 y) {
Word32 result =
__sync_val_compare_and_swap(((Word32*)a) + i, *((Word32*)&x), *((Word32*)&y));
return *((Real32*)&result);
}

#define RefW8_cas(r, x, y) __sync_val_compare_and_swap((Word8*)(r), (x), (y))
#define RefW16_cas(r, x, y) __sync_val_compare_and_swap((Word16*)(r), (x), (y))
#define RefW32_cas(r, x, y) __sync_val_compare_and_swap((Word32*)(r), (x), (y))
Expand All @@ -87,7 +94,7 @@ Objptr RefP_cas(Objptr* r, Objptr x, Objptr y) {
#define ArrayW32_cas(a, i, x, y) __sync_val_compare_and_swap(((Word32*)(a)) + (i), (x), (y))
#define ArrayW64_cas(a, i, x, y) __sync_val_compare_and_swap(((Word64*)(a)) + (i), (x), (y))

#define ArrayR32_cas(a, i, x, y) __sync_val_compare_and_swap(((Real32*)(a)) + (i), (x), (y))
// #define ArrayR32_cas(a, i, x, y) __sync_val_compare_and_swap(((Real32*)(a)) + (i), (x), (y))
// #define ArrayR64_cas(a, i, x, y) __sync_val_compare_and_swap(((Real64*)(a)) + (i), (x), (y))

// #define ArrayP_cas(a, i, x, y) __sync_val_compare_and_swap(((Objptr*)(a)) + (i), (x), (y))
Expand Down

0 comments on commit 5a98337

Please sign in to comment.