mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Fold LIBC_BITS into LIBC_INTRIN
This commit is contained in:
parent
625aa365f1
commit
05b8f82371
603 changed files with 1071 additions and 1211 deletions
16
libc/intrin/xadd.h
Normal file
16
libc/intrin/xadd.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_BITS_XADD_H_
|
||||
#define COSMOPOLITAN_LIBC_BITS_XADD_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define _xadd(p, v) \
|
||||
({ \
|
||||
typeof(*(p)) Res; \
|
||||
autotype(Res) Val = (v); \
|
||||
asm volatile("xadd\t%0,%1" : "=r"(Res), "+m"(*(p)) : "0"(Val)); \
|
||||
Res + Val; \
|
||||
})
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_BITS_XADD_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue