mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 09:17:53 +00:00
This change greatly reduces the number of modules that need to be compiled. The only issue right now is that sometimes when viewing symbol table entries, the aliased symbol is chosen.
28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
#ifndef COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_
|
|
#define COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
#ifdef COSMO
|
|
|
|
forceinline void repmovsb(void **dest, const void **src, size_t cx) {
|
|
char *di = (char *)*dest;
|
|
const char *si = (const char *)*src;
|
|
while (cx) *di++ = *si++, cx--;
|
|
*dest = di, *src = si;
|
|
}
|
|
|
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
|
#define repmovsb(DI, SI, CX) \
|
|
({ \
|
|
void *Di = *(DI); \
|
|
const void *Si = *(SI); \
|
|
size_t Cx = (CX); \
|
|
asm("rep movsb" \
|
|
: "=D"(Di), "=S"(Si), "=c"(Cx), "=m"(*(char(*)[Cx])Di) \
|
|
: "0"(Di), "1"(Si), "2"(Cx), "m"(*(const char(*)[Cx])Si)); \
|
|
*(DI) = Di, *(SI) = Si; \
|
|
})
|
|
#endif
|
|
|
|
#endif /* COSMO */
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_INTRIN_REPMOVSB_H_ */
|