mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Add Musl multibyte functions
These are standard functions that are needed to help support the Skull language. Note that normally this codebase uses libc/str/thompike.h See #105
This commit is contained in:
parent
cfd453d125
commit
11ec99931b
28 changed files with 1064 additions and 131 deletions
19
libc/str/mb.internal.h
Normal file
19
libc/str/mb.internal.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_STR_MB_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_STR_MB_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define SA 0xc2u
|
||||
#define SB 0xf4u
|
||||
#define CODEUNIT(c) (0xdfff & (signed char)(c))
|
||||
#define IS_CODEUNIT(c) ((unsigned)(c)-0xdf80 < 0x80)
|
||||
#define R(a, b) ((uint32_t)((a == 0x80 ? 0x40u - b : 0u - a) << 23))
|
||||
#define FAILSTATE R(0x80, 0x80)
|
||||
#define OOB(c, b) \
|
||||
(((((b) >> 3) - 0x10) | (((b) >> 3) + ((int32_t)(c) >> 26))) & ~7)
|
||||
|
||||
extern const uint32_t kMbBittab[51];
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_STR_MB_INTERNAL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue