mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Make improvements
- Fix build flakes - Polyfill SIGWINCH on Windows - Fix an execve issue on Windows - Make strerror show more information - Improve cmd.exe setup/teardown on Windows - Support bracketed paste mode in Blinkenlights - Show keyboard shortcuts in Blinkenlights status bar - Fixed copy_file_range() and copyfile() w/ zip filesystem - Size optimize GetDosArgv() to keep life.com 12kb in size - Improve Blinkenlights ability to load weird ELF executables - Fix program_executable_name and add GetInterpreterExecutableName - Make Python in tiny mode fail better if docstrings are requested - Update Python test exclusions in tiny* modes such as tinylinux - Add bulletproof unbreakable kprintf() troubleshooting function - Remove "oldskool" keyword from ape.S for virus scanners - Fix issue that caused backtraces to not print sometimes - Improve Blinkenlights serial uart character i/o - Make clock_gettime() not clobber errno on xnu - Improve sha256 cpuid check for old computers - Integrate some bestline linenoise fixes - Show runit process names better in htop - Remove SIGPIPE from ShowCrashReports() - Make realpath() not clobber errno - Avoid attaching GDB on non-Linux - Improve img.com example
This commit is contained in:
parent
2a938b3eaa
commit
b45d50b690
194 changed files with 4881 additions and 2966 deletions
|
@ -1,20 +1,23 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_STR_UTF16_H_
|
||||
#define COSMOPOLITAN_LIBC_STR_UTF16_H_
|
||||
#include "libc/bits/likely.h"
|
||||
|
||||
#define UTF16_MASK 0xfc00
|
||||
#define UTF16_MOAR 0xd800 /* 0xD800..0xDBFF */
|
||||
#define UTF16_CONT 0xdc00 /* 0xDC00..0xDBFF */
|
||||
#define UTF16_CONT 0xdc00 /* 0xDC00..0xDFFF */
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
#define IsUcs2(wc) (((wc)&UTF16_MASK) != UTF16_MOAR)
|
||||
#define IsUtf16Cont(wc) (((wc)&UTF16_MASK) == UTF16_CONT)
|
||||
#define MergeUtf16(lo, hi) ((((lo)-0xD800) << 10) + ((hi)-0xDC00) + 0x10000)
|
||||
#define IsSurrogate(wc) ((0xf800 & (wc)) == 0xd800)
|
||||
#define IsHighSurrogate(wc) ((UTF16_MASK & (wc)) == UTF16_MOAR)
|
||||
#define IsLowSurrogate(wc) ((UTF16_MASK & (wc)) == UTF16_CONT)
|
||||
#define IsUcs2(wc) (((65535 & (wc)) >> 11) != 27)
|
||||
#define IsUtf16Cont(wc) IsLowSurrogate(wc) /* TODO: DELETE */
|
||||
#define MergeUtf16(hi, lo) ((((hi)-0xD800) << 10) + ((lo)-0xDC00) + 0x10000)
|
||||
#define EncodeUtf16(wc) \
|
||||
(__builtin_expect(((0x0000 <= (wc) && (wc) <= 0xFFFF) || \
|
||||
(0xE000 <= (wc) && (wc) <= 0xFFFF)), \
|
||||
1) \
|
||||
(LIKELY((0x0000 <= (wc) && (wc) <= 0xFFFF) || \
|
||||
(0xE000 <= (wc) && (wc) <= 0xFFFF)) \
|
||||
? (wc) \
|
||||
: 0x10000 <= (wc) && (wc) <= 0x10FFFF \
|
||||
? (((((wc)-0x10000) >> 10) + 0xD800) | \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue