A new rollup tool now exists for flattening out the headers in a way that works better for our purposes than cpp. A lot of the API clutter has been removed. APIs that aren't a sure thing in terms of general recommendation are now marked internal. There's now a smoke test for the amalgamation archive and gigantic header file. So we can now guarantee you can use this project on the easiest difficulty setting without the gigantic repository. A website is being created, which is currently a work in progress: https://justine.storage.googleapis.com/cosmopolitan/index.html
27 lines
777 B
C
27 lines
777 B
C
#ifndef COSMOPOLITAN_LIBC_STR_STRCMP8TO16I_H_
|
|
#define COSMOPOLITAN_LIBC_STR_STRCMP8TO16I_H_
|
|
#include "libc/conv/conv.h"
|
|
#include "libc/str/oldutf16.internal.h"
|
|
#include "libc/str/str.h"
|
|
#include "libc/str/tpdecode.internal.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
forceinline int strcmp8to16i(const char *s1, const char16_t *s2, size_t n,
|
|
unsigned xlat(unsigned)) {
|
|
int res = 0;
|
|
if (n) {
|
|
do {
|
|
wint_t wc1, wc2;
|
|
s1 += abs(tpdecode(s1, &wc1));
|
|
s2 += abs(getutf16(s2, &wc2));
|
|
if ((res = xlat(wc1) - xlat(wc2)) || !wc1) break;
|
|
} while (n == -1ul || --n);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_STR_STRCMP8TO16I_H_ */
|