source: azure_iot_hub/trunk/musl-1.1.18/src/ctype/wcwidth.c@ 389

Last change on this file since 389 was 389, checked in by coas-nagasima, 5 years ago

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 604 bytes
Line 
1#include <wchar.h>
2
3static const unsigned char table[] = {
4#include "nonspacing.h"
5};
6
7static const unsigned char wtable[] = {
8#include "wide.h"
9};
10
11int wcwidth(wchar_t wc)
12{
13 if (wc < 0xffU)
14 return (wc+1 & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0;
15 if ((wc & 0xfffeffffU) < 0xfffe) {
16 if ((table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
17 return 0;
18 if ((wtable[wtable[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1)
19 return 2;
20 return 1;
21 }
22 if ((wc & 0xfffe) == 0xfffe)
23 return -1;
24 if (wc-0x20000U < 0x20000)
25 return 2;
26 if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100 < 0xef)
27 return 0;
28 return 1;
29}
Note: See TracBrowser for help on using the repository browser.