1 /* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
15 return 0; /* surrogate character */
19 return 0; /* illegal character */
23 return 0; /* rune too large */
27 runetochar(char *s
, const Rune
*p
)
32 case 1: /* 0aaaaaaa */
35 case 2: /* 00000aaa aabbbbbb */
36 s
[0] = 0xC0 | ((r
& 0x0007C0) >> 6); /* 110aaaaa */
37 s
[1] = 0x80 | (r
& 0x00003F); /* 10bbbbbb */
39 case 3: /* aaaabbbb bbcccccc */
40 s
[0] = 0xE0 | ((r
& 0x00F000) >> 12); /* 1110aaaa */
41 s
[1] = 0x80 | ((r
& 0x000FC0) >> 6); /* 10bbbbbb */
42 s
[2] = 0x80 | (r
& 0x00003F); /* 10cccccc */
44 case 4: /* 000aaabb bbbbcccc ccdddddd */
45 s
[0] = 0xF0 | ((r
& 0x1C0000) >> 18); /* 11110aaa */
46 s
[1] = 0x80 | ((r
& 0x03F000) >> 12); /* 10bbbbbb */
47 s
[2] = 0x80 | ((r
& 0x000FC0) >> 6); /* 10cccccc */
48 s
[3] = 0x80 | (r
& 0x00003F); /* 10dddddd */