diff options
| author | Tyge Løvset <[email protected]> | 2021-06-08 13:41:51 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-06-08 13:46:27 +0200 |
| commit | e9bb6c5f86f7129d2695e43ef5842e3d9c06c372 (patch) | |
| tree | c89c1a954e9202189dafc34340b20902954f5063 /include/stc/csptr.h | |
| parent | 1d3c1e2e61dcf82d85c279831801544d401fe889 (diff) | |
| parent | 42e9e49a4d2882cb5463a27bea5718fd2579b2db (diff) | |
| download | STC-modified-e9bb6c5f86f7129d2695e43ef5842e3d9c06c372.tar.gz STC-modified-e9bb6c5f86f7129d2695e43ef5842e3d9c06c372.zip | |
Merge branch 'master' of https://github.com/tylo-work/C99Containers into master
Diffstat (limited to 'include/stc/csptr.h')
| -rw-r--r-- | include/stc/csptr.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/csptr.h b/include/stc/csptr.h index 5762c5db..4b35e98c 100644 --- a/include/stc/csptr.h +++ b/include/stc/csptr.h @@ -63,9 +63,9 @@ typedef long atomic_count_t; STC_INLINE void c_atomic_increment(atomic_count_t* v)
{ __asm__ __volatile__("lock; incq %0" :"=m"(*v) :"m"(*v)); }
STC_INLINE atomic_count_t c_atomic_decrement(atomic_count_t* v) {
- atomic_count_t i = -1;
- __asm__ __volatile__("lock; xadd %0, %1" :"=r"(i) :"m"(*v), "0"(i));
- return i - 1;
+ atomic_count_t r;
+ __asm__ __volatile__("lock; xadd %0, %1" :"=r"(r) :"m"(*v), "0"(-1));
+ return r - 1;
}
#endif
|
