Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: fusl/src/ctype/wcwidth.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <wchar.h> 1 #include <wchar.h>
2 2
3 static const unsigned char table[] = { 3 static const unsigned char table[] = {
4 #include "nonspacing.h" 4 #include "nonspacing.h"
5 }; 5 };
6 6
7 static const unsigned char wtable[] = { 7 static const unsigned char wtable[] = {
8 #include "wide.h" 8 #include "wide.h"
9 }; 9 };
10 10
11 int wcwidth(wchar_t wc) 11 int wcwidth(wchar_t wc) {
12 { 12 if (wc < 0xffU)
13 » if (wc < 0xffU) 13 return (wc + 1 & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0;
14 » » return (wc+1 & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0; 14 if ((wc & 0xfffeffffU) < 0xfffe) {
15 » if ((wc & 0xfffeffffU) < 0xfffe) { 15 if ((table[table[wc >> 8] * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1)
16 » » if ((table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1) 16 return 0;
17 » » » return 0; 17 if ((wtable[wtable[wc >> 8] * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1)
18 » » if ((wtable[wtable[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1) 18 return 2;
19 » » » return 2; 19 return 1;
20 » » return 1; 20 }
21 » } 21 if ((wc & 0xfffe) == 0xfffe)
22 » if ((wc & 0xfffe) == 0xfffe) 22 return -1;
23 » » return -1; 23 if (wc - 0x20000U < 0x20000)
24 » if (wc-0x20000U < 0x20000) 24 return 2;
25 » » return 2; 25 if (wc == 0xe0001 || wc - 0xe0020U < 0x5f || wc - 0xe0100 < 0xef)
26 » if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100 < 0xef) 26 return 0;
27 » » return 0; 27 return 1;
28 » return 1;
29 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698