mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Run clang-format (#1197)
This commit is contained in:
parent
ea081b262c
commit
f032b5570b
183 changed files with 1074 additions and 983 deletions
|
@ -13,25 +13,30 @@
|
|||
forceinline int tpdecodecb(wint_t *out, int first,
|
||||
int get(void *arg, uint32_t i), void *arg) {
|
||||
uint32_t wc, cb, need, msb, j, i = 1;
|
||||
if (__builtin_expect((wc = first) == -1, 0)) return -1;
|
||||
if (__builtin_expect((wc = first) == -1, 0))
|
||||
return -1;
|
||||
while (__builtin_expect((wc & 0b11000000) == 0b10000000, 0)) {
|
||||
if ((wc = get(arg, i++)) == -1) return -1;
|
||||
if ((wc = get(arg, i++)) == -1)
|
||||
return -1;
|
||||
}
|
||||
if (__builtin_expect(!(0 <= wc && wc <= 0x7F), 0)) {
|
||||
msb = wc < 252 ? bsr(~wc & 0xff) : 1;
|
||||
need = 7 - msb;
|
||||
wc &= ((1u << msb) - 1) | 0b00000011;
|
||||
for (j = 1; j < need; ++j) {
|
||||
if ((cb = get(arg, i++)) == -1) return -1;
|
||||
if ((cb = get(arg, i++)) == -1)
|
||||
return -1;
|
||||
if ((cb & 0b11000000) == 0b10000000) {
|
||||
wc = wc << 6 | (cb & 0b00111111);
|
||||
} else {
|
||||
if (out) *out = u'\xFFFD';
|
||||
if (out)
|
||||
*out = u'\xFFFD';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (__builtin_expect(!!out, 1)) *out = (wint_t)wc;
|
||||
if (__builtin_expect(!!out, 1))
|
||||
*out = (wint_t)wc;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue