mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
416fd86676
- Emulator can now test the αcτµαlly pδrταblε εxεcµταblε bootloader - Whipped up a webserver named redbean. It services 150k requests per second on a single core. Bundling assets inside zip enables extremely fast serving for two reasons. The first is that zip central directory lookups go faster than stat() system calls. The second is that both zip and gzip content-encoding use DEFLATE, therefore, compressed responses can be served via the sendfile() system call which does an in-kernel copy directly from the zip executable structure. Also note that red bean zip executables can be deployed easily to all platforms, since these native executables work on Linux, Mac, BSD, and Windows. - Address sanitizer now works very well
25 lines
964 B
C
25 lines
964 B
C
#ifndef COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_
|
|
#define COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
forceinline void *repstosb(void *dest, unsigned char al, size_t cx) {
|
|
unsigned char *di = (unsigned char *)dest;
|
|
while (cx) *di++ = al, cx--;
|
|
return di;
|
|
}
|
|
|
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
|
#define repstosb(DI, AL, CX) \
|
|
({ \
|
|
void *Di = (DI); \
|
|
size_t Cx = (CX); \
|
|
unsigned char Al = (AL); \
|
|
asm("rep stosb %b5,(%0)" \
|
|
: "=D"(Di), "=c"(Cx), "=m"(*(char(*)[Cx])Di) \
|
|
: "0"(Di), "1"(Cx), "a"(Al)); \
|
|
Di; \
|
|
})
|
|
#endif
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_INTRIN_REPSTOSB_H_ */
|