xref: /freebsd/contrib/llvm-project/llvm/lib/Support/UnicodeCaseFold.cpp (revision 59aa64914aeb1b2cccc0d4fc39ead2ee159a1e5b)
1  //===---------- Support/UnicodeCaseFold.cpp -------------------------------===//
2  //
3  // This file was generated by utils/unicode-case-fold.py from the Unicode
4  // case folding database at
5  //    http://www.unicode.org/Public/15.1.0/ucd/CaseFolding.txt
6  //
7  // To regenerate this file, run:
8  //   utils/unicode-case-fold.py \
9  //     "http://www.unicode.org/Public/15.1.0/ucd/CaseFolding.txt" \
10  //     > lib/Support/UnicodeCaseFold.cpp
11  //
12  //===----------------------------------------------------------------------===//
13  
14  #include "llvm/Support/Unicode.h"
15  
16  int llvm::sys::unicode::foldCharSimple(int C) {
17    if (C < 0x0041)
18      return C;
19    // 26 characters
20    if (C <= 0x005a)
21      return C + 32;
22    // MICRO SIGN
23    if (C == 0x00b5)
24      return 0x03bc;
25    if (C < 0x00c0)
26      return C;
27    // 23 characters
28    if (C <= 0x00d6)
29      return C + 32;
30    if (C < 0x00d8)
31      return C;
32    // 7 characters
33    if (C <= 0x00de)
34      return C + 32;
35    if (C < 0x0100)
36      return C;
37    // 24 characters
38    if (C <= 0x012e)
39      return C | 1;
40    if (C < 0x0132)
41      return C;
42    // 3 characters
43    if (C <= 0x0136)
44      return C | 1;
45    if (C < 0x0139)
46      return C;
47    // 8 characters
48    if (C <= 0x0147 && C % 2 == 1)
49      return C + 1;
50    if (C < 0x014a)
51      return C;
52    // 23 characters
53    if (C <= 0x0176)
54      return C | 1;
55    // LATIN CAPITAL LETTER Y WITH DIAERESIS
56    if (C == 0x0178)
57      return 0x00ff;
58    if (C < 0x0179)
59      return C;
60    // 3 characters
61    if (C <= 0x017d && C % 2 == 1)
62      return C + 1;
63    // LATIN SMALL LETTER LONG S
64    if (C == 0x017f)
65      return 0x0073;
66    // LATIN CAPITAL LETTER B WITH HOOK
67    if (C == 0x0181)
68      return 0x0253;
69    if (C < 0x0182)
70      return C;
71    // 2 characters
72    if (C <= 0x0184)
73      return C | 1;
74    // LATIN CAPITAL LETTER OPEN O
75    if (C == 0x0186)
76      return 0x0254;
77    // LATIN CAPITAL LETTER C WITH HOOK
78    if (C == 0x0187)
79      return 0x0188;
80    if (C < 0x0189)
81      return C;
82    // 2 characters
83    if (C <= 0x018a)
84      return C + 205;
85    // LATIN CAPITAL LETTER D WITH TOPBAR
86    if (C == 0x018b)
87      return 0x018c;
88    // LATIN CAPITAL LETTER REVERSED E
89    if (C == 0x018e)
90      return 0x01dd;
91    // LATIN CAPITAL LETTER SCHWA
92    if (C == 0x018f)
93      return 0x0259;
94    // LATIN CAPITAL LETTER OPEN E
95    if (C == 0x0190)
96      return 0x025b;
97    // LATIN CAPITAL LETTER F WITH HOOK
98    if (C == 0x0191)
99      return 0x0192;
100    // LATIN CAPITAL LETTER G WITH HOOK
101    if (C == 0x0193)
102      return 0x0260;
103    // LATIN CAPITAL LETTER GAMMA
104    if (C == 0x0194)
105      return 0x0263;
106    // LATIN CAPITAL LETTER IOTA
107    if (C == 0x0196)
108      return 0x0269;
109    // LATIN CAPITAL LETTER I WITH STROKE
110    if (C == 0x0197)
111      return 0x0268;
112    // LATIN CAPITAL LETTER K WITH HOOK
113    if (C == 0x0198)
114      return 0x0199;
115    // LATIN CAPITAL LETTER TURNED M
116    if (C == 0x019c)
117      return 0x026f;
118    // LATIN CAPITAL LETTER N WITH LEFT HOOK
119    if (C == 0x019d)
120      return 0x0272;
121    // LATIN CAPITAL LETTER O WITH MIDDLE TILDE
122    if (C == 0x019f)
123      return 0x0275;
124    if (C < 0x01a0)
125      return C;
126    // 3 characters
127    if (C <= 0x01a4)
128      return C | 1;
129    // LATIN LETTER YR
130    if (C == 0x01a6)
131      return 0x0280;
132    // LATIN CAPITAL LETTER TONE TWO
133    if (C == 0x01a7)
134      return 0x01a8;
135    // LATIN CAPITAL LETTER ESH
136    if (C == 0x01a9)
137      return 0x0283;
138    // LATIN CAPITAL LETTER T WITH HOOK
139    if (C == 0x01ac)
140      return 0x01ad;
141    // LATIN CAPITAL LETTER T WITH RETROFLEX HOOK
142    if (C == 0x01ae)
143      return 0x0288;
144    // LATIN CAPITAL LETTER U WITH HORN
145    if (C == 0x01af)
146      return 0x01b0;
147    if (C < 0x01b1)
148      return C;
149    // 2 characters
150    if (C <= 0x01b2)
151      return C + 217;
152    if (C < 0x01b3)
153      return C;
154    // 2 characters
155    if (C <= 0x01b5 && C % 2 == 1)
156      return C + 1;
157    // LATIN CAPITAL LETTER EZH
158    if (C == 0x01b7)
159      return 0x0292;
160    if (C < 0x01b8)
161      return C;
162    // 2 characters
163    if (C <= 0x01bc && C % 4 == 0)
164      return C + 1;
165    // LATIN CAPITAL LETTER DZ WITH CARON
166    if (C == 0x01c4)
167      return 0x01c6;
168    // LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
169    if (C == 0x01c5)
170      return 0x01c6;
171    // LATIN CAPITAL LETTER LJ
172    if (C == 0x01c7)
173      return 0x01c9;
174    // LATIN CAPITAL LETTER L WITH SMALL LETTER J
175    if (C == 0x01c8)
176      return 0x01c9;
177    // LATIN CAPITAL LETTER NJ
178    if (C == 0x01ca)
179      return 0x01cc;
180    if (C < 0x01cb)
181      return C;
182    // 9 characters
183    if (C <= 0x01db && C % 2 == 1)
184      return C + 1;
185    if (C < 0x01de)
186      return C;
187    // 9 characters
188    if (C <= 0x01ee)
189      return C | 1;
190    // LATIN CAPITAL LETTER DZ
191    if (C == 0x01f1)
192      return 0x01f3;
193    if (C < 0x01f2)
194      return C;
195    // 2 characters
196    if (C <= 0x01f4)
197      return C | 1;
198    // LATIN CAPITAL LETTER HWAIR
199    if (C == 0x01f6)
200      return 0x0195;
201    // LATIN CAPITAL LETTER WYNN
202    if (C == 0x01f7)
203      return 0x01bf;
204    if (C < 0x01f8)
205      return C;
206    // 20 characters
207    if (C <= 0x021e)
208      return C | 1;
209    // LATIN CAPITAL LETTER N WITH LONG RIGHT LEG
210    if (C == 0x0220)
211      return 0x019e;
212    if (C < 0x0222)
213      return C;
214    // 9 characters
215    if (C <= 0x0232)
216      return C | 1;
217    // LATIN CAPITAL LETTER A WITH STROKE
218    if (C == 0x023a)
219      return 0x2c65;
220    // LATIN CAPITAL LETTER C WITH STROKE
221    if (C == 0x023b)
222      return 0x023c;
223    // LATIN CAPITAL LETTER L WITH BAR
224    if (C == 0x023d)
225      return 0x019a;
226    // LATIN CAPITAL LETTER T WITH DIAGONAL STROKE
227    if (C == 0x023e)
228      return 0x2c66;
229    // LATIN CAPITAL LETTER GLOTTAL STOP
230    if (C == 0x0241)
231      return 0x0242;
232    // LATIN CAPITAL LETTER B WITH STROKE
233    if (C == 0x0243)
234      return 0x0180;
235    // LATIN CAPITAL LETTER U BAR
236    if (C == 0x0244)
237      return 0x0289;
238    // LATIN CAPITAL LETTER TURNED V
239    if (C == 0x0245)
240      return 0x028c;
241    if (C < 0x0246)
242      return C;
243    // 5 characters
244    if (C <= 0x024e)
245      return C | 1;
246    // COMBINING GREEK YPOGEGRAMMENI
247    if (C == 0x0345)
248      return 0x03b9;
249    if (C < 0x0370)
250      return C;
251    // 2 characters
252    if (C <= 0x0372)
253      return C | 1;
254    // GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA
255    if (C == 0x0376)
256      return 0x0377;
257    // GREEK CAPITAL LETTER YOT
258    if (C == 0x037f)
259      return 0x03f3;
260    // GREEK CAPITAL LETTER ALPHA WITH TONOS
261    if (C == 0x0386)
262      return 0x03ac;
263    if (C < 0x0388)
264      return C;
265    // 3 characters
266    if (C <= 0x038a)
267      return C + 37;
268    // GREEK CAPITAL LETTER OMICRON WITH TONOS
269    if (C == 0x038c)
270      return 0x03cc;
271    if (C < 0x038e)
272      return C;
273    // 2 characters
274    if (C <= 0x038f)
275      return C + 63;
276    if (C < 0x0391)
277      return C;
278    // 17 characters
279    if (C <= 0x03a1)
280      return C + 32;
281    if (C < 0x03a3)
282      return C;
283    // 9 characters
284    if (C <= 0x03ab)
285      return C + 32;
286    // GREEK SMALL LETTER FINAL SIGMA
287    if (C == 0x03c2)
288      return 0x03c3;
289    // GREEK CAPITAL KAI SYMBOL
290    if (C == 0x03cf)
291      return 0x03d7;
292    // GREEK BETA SYMBOL
293    if (C == 0x03d0)
294      return 0x03b2;
295    // GREEK THETA SYMBOL
296    if (C == 0x03d1)
297      return 0x03b8;
298    // GREEK PHI SYMBOL
299    if (C == 0x03d5)
300      return 0x03c6;
301    // GREEK PI SYMBOL
302    if (C == 0x03d6)
303      return 0x03c0;
304    if (C < 0x03d8)
305      return C;
306    // 12 characters
307    if (C <= 0x03ee)
308      return C | 1;
309    // GREEK KAPPA SYMBOL
310    if (C == 0x03f0)
311      return 0x03ba;
312    // GREEK RHO SYMBOL
313    if (C == 0x03f1)
314      return 0x03c1;
315    // GREEK CAPITAL THETA SYMBOL
316    if (C == 0x03f4)
317      return 0x03b8;
318    // GREEK LUNATE EPSILON SYMBOL
319    if (C == 0x03f5)
320      return 0x03b5;
321    // GREEK CAPITAL LETTER SHO
322    if (C == 0x03f7)
323      return 0x03f8;
324    // GREEK CAPITAL LUNATE SIGMA SYMBOL
325    if (C == 0x03f9)
326      return 0x03f2;
327    // GREEK CAPITAL LETTER SAN
328    if (C == 0x03fa)
329      return 0x03fb;
330    if (C < 0x03fd)
331      return C;
332    // 3 characters
333    if (C <= 0x03ff)
334      return C + -130;
335    if (C < 0x0400)
336      return C;
337    // 16 characters
338    if (C <= 0x040f)
339      return C + 80;
340    if (C < 0x0410)
341      return C;
342    // 32 characters
343    if (C <= 0x042f)
344      return C + 32;
345    if (C < 0x0460)
346      return C;
347    // 17 characters
348    if (C <= 0x0480)
349      return C | 1;
350    if (C < 0x048a)
351      return C;
352    // 27 characters
353    if (C <= 0x04be)
354      return C | 1;
355    // CYRILLIC LETTER PALOCHKA
356    if (C == 0x04c0)
357      return 0x04cf;
358    if (C < 0x04c1)
359      return C;
360    // 7 characters
361    if (C <= 0x04cd && C % 2 == 1)
362      return C + 1;
363    if (C < 0x04d0)
364      return C;
365    // 48 characters
366    if (C <= 0x052e)
367      return C | 1;
368    if (C < 0x0531)
369      return C;
370    // 38 characters
371    if (C <= 0x0556)
372      return C + 48;
373    if (C < 0x10a0)
374      return C;
375    // 38 characters
376    if (C <= 0x10c5)
377      return C + 7264;
378    if (C < 0x10c7)
379      return C;
380    // 2 characters
381    if (C <= 0x10cd && C % 6 == 5)
382      return C + 7264;
383    if (C < 0x13f8)
384      return C;
385    // 6 characters
386    if (C <= 0x13fd)
387      return C + -8;
388    // CYRILLIC SMALL LETTER ROUNDED VE
389    if (C == 0x1c80)
390      return 0x0432;
391    // CYRILLIC SMALL LETTER LONG-LEGGED DE
392    if (C == 0x1c81)
393      return 0x0434;
394    // CYRILLIC SMALL LETTER NARROW O
395    if (C == 0x1c82)
396      return 0x043e;
397    if (C < 0x1c83)
398      return C;
399    // 2 characters
400    if (C <= 0x1c84)
401      return C + -6210;
402    // CYRILLIC SMALL LETTER THREE-LEGGED TE
403    if (C == 0x1c85)
404      return 0x0442;
405    // CYRILLIC SMALL LETTER TALL HARD SIGN
406    if (C == 0x1c86)
407      return 0x044a;
408    // CYRILLIC SMALL LETTER TALL YAT
409    if (C == 0x1c87)
410      return 0x0463;
411    // CYRILLIC SMALL LETTER UNBLENDED UK
412    if (C == 0x1c88)
413      return 0xa64b;
414    if (C < 0x1c90)
415      return C;
416    // 43 characters
417    if (C <= 0x1cba)
418      return C + -3008;
419    if (C < 0x1cbd)
420      return C;
421    // 3 characters
422    if (C <= 0x1cbf)
423      return C + -3008;
424    if (C < 0x1e00)
425      return C;
426    // 75 characters
427    if (C <= 0x1e94)
428      return C | 1;
429    // LATIN SMALL LETTER LONG S WITH DOT ABOVE
430    if (C == 0x1e9b)
431      return 0x1e61;
432    // LATIN CAPITAL LETTER SHARP S
433    if (C == 0x1e9e)
434      return 0x00df;
435    if (C < 0x1ea0)
436      return C;
437    // 48 characters
438    if (C <= 0x1efe)
439      return C | 1;
440    if (C < 0x1f08)
441      return C;
442    // 8 characters
443    if (C <= 0x1f0f)
444      return C + -8;
445    if (C < 0x1f18)
446      return C;
447    // 6 characters
448    if (C <= 0x1f1d)
449      return C + -8;
450    if (C < 0x1f28)
451      return C;
452    // 8 characters
453    if (C <= 0x1f2f)
454      return C + -8;
455    if (C < 0x1f38)
456      return C;
457    // 8 characters
458    if (C <= 0x1f3f)
459      return C + -8;
460    if (C < 0x1f48)
461      return C;
462    // 6 characters
463    if (C <= 0x1f4d)
464      return C + -8;
465    if (C < 0x1f59)
466      return C;
467    // 4 characters
468    if (C <= 0x1f5f && C % 2 == 1)
469      return C + -8;
470    if (C < 0x1f68)
471      return C;
472    // 8 characters
473    if (C <= 0x1f6f)
474      return C + -8;
475    if (C < 0x1f88)
476      return C;
477    // 8 characters
478    if (C <= 0x1f8f)
479      return C + -8;
480    if (C < 0x1f98)
481      return C;
482    // 8 characters
483    if (C <= 0x1f9f)
484      return C + -8;
485    if (C < 0x1fa8)
486      return C;
487    // 8 characters
488    if (C <= 0x1faf)
489      return C + -8;
490    if (C < 0x1fb8)
491      return C;
492    // 2 characters
493    if (C <= 0x1fb9)
494      return C + -8;
495    if (C < 0x1fba)
496      return C;
497    // 2 characters
498    if (C <= 0x1fbb)
499      return C + -74;
500    // GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI
501    if (C == 0x1fbc)
502      return 0x1fb3;
503    // GREEK PROSGEGRAMMENI
504    if (C == 0x1fbe)
505      return 0x03b9;
506    if (C < 0x1fc8)
507      return C;
508    // 4 characters
509    if (C <= 0x1fcb)
510      return C + -86;
511    // GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI
512    if (C == 0x1fcc)
513      return 0x1fc3;
514    // GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
515    if (C == 0x1fd3)
516      return 0x0390;
517    if (C < 0x1fd8)
518      return C;
519    // 2 characters
520    if (C <= 0x1fd9)
521      return C + -8;
522    if (C < 0x1fda)
523      return C;
524    // 2 characters
525    if (C <= 0x1fdb)
526      return C + -100;
527    // GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
528    if (C == 0x1fe3)
529      return 0x03b0;
530    if (C < 0x1fe8)
531      return C;
532    // 2 characters
533    if (C <= 0x1fe9)
534      return C + -8;
535    if (C < 0x1fea)
536      return C;
537    // 2 characters
538    if (C <= 0x1feb)
539      return C + -112;
540    // GREEK CAPITAL LETTER RHO WITH DASIA
541    if (C == 0x1fec)
542      return 0x1fe5;
543    if (C < 0x1ff8)
544      return C;
545    // 2 characters
546    if (C <= 0x1ff9)
547      return C + -128;
548    if (C < 0x1ffa)
549      return C;
550    // 2 characters
551    if (C <= 0x1ffb)
552      return C + -126;
553    // GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
554    if (C == 0x1ffc)
555      return 0x1ff3;
556    // OHM SIGN
557    if (C == 0x2126)
558      return 0x03c9;
559    // KELVIN SIGN
560    if (C == 0x212a)
561      return 0x006b;
562    // ANGSTROM SIGN
563    if (C == 0x212b)
564      return 0x00e5;
565    // TURNED CAPITAL F
566    if (C == 0x2132)
567      return 0x214e;
568    if (C < 0x2160)
569      return C;
570    // 16 characters
571    if (C <= 0x216f)
572      return C + 16;
573    // ROMAN NUMERAL REVERSED ONE HUNDRED
574    if (C == 0x2183)
575      return 0x2184;
576    if (C < 0x24b6)
577      return C;
578    // 26 characters
579    if (C <= 0x24cf)
580      return C + 26;
581    if (C < 0x2c00)
582      return C;
583    // 48 characters
584    if (C <= 0x2c2f)
585      return C + 48;
586    // LATIN CAPITAL LETTER L WITH DOUBLE BAR
587    if (C == 0x2c60)
588      return 0x2c61;
589    // LATIN CAPITAL LETTER L WITH MIDDLE TILDE
590    if (C == 0x2c62)
591      return 0x026b;
592    // LATIN CAPITAL LETTER P WITH STROKE
593    if (C == 0x2c63)
594      return 0x1d7d;
595    // LATIN CAPITAL LETTER R WITH TAIL
596    if (C == 0x2c64)
597      return 0x027d;
598    if (C < 0x2c67)
599      return C;
600    // 3 characters
601    if (C <= 0x2c6b && C % 2 == 1)
602      return C + 1;
603    // LATIN CAPITAL LETTER ALPHA
604    if (C == 0x2c6d)
605      return 0x0251;
606    // LATIN CAPITAL LETTER M WITH HOOK
607    if (C == 0x2c6e)
608      return 0x0271;
609    // LATIN CAPITAL LETTER TURNED A
610    if (C == 0x2c6f)
611      return 0x0250;
612    // LATIN CAPITAL LETTER TURNED ALPHA
613    if (C == 0x2c70)
614      return 0x0252;
615    if (C < 0x2c72)
616      return C;
617    // 2 characters
618    if (C <= 0x2c75 && C % 3 == 2)
619      return C + 1;
620    if (C < 0x2c7e)
621      return C;
622    // 2 characters
623    if (C <= 0x2c7f)
624      return C + -10815;
625    if (C < 0x2c80)
626      return C;
627    // 50 characters
628    if (C <= 0x2ce2)
629      return C | 1;
630    if (C < 0x2ceb)
631      return C;
632    // 2 characters
633    if (C <= 0x2ced && C % 2 == 1)
634      return C + 1;
635    if (C < 0x2cf2)
636      return C;
637    // 2 characters
638    if (C <= 0xa640 && C % 31054 == 11506)
639      return C + 1;
640    if (C < 0xa642)
641      return C;
642    // 22 characters
643    if (C <= 0xa66c)
644      return C | 1;
645    if (C < 0xa680)
646      return C;
647    // 14 characters
648    if (C <= 0xa69a)
649      return C | 1;
650    if (C < 0xa722)
651      return C;
652    // 7 characters
653    if (C <= 0xa72e)
654      return C | 1;
655    if (C < 0xa732)
656      return C;
657    // 31 characters
658    if (C <= 0xa76e)
659      return C | 1;
660    if (C < 0xa779)
661      return C;
662    // 2 characters
663    if (C <= 0xa77b && C % 2 == 1)
664      return C + 1;
665    // LATIN CAPITAL LETTER INSULAR G
666    if (C == 0xa77d)
667      return 0x1d79;
668    if (C < 0xa77e)
669      return C;
670    // 5 characters
671    if (C <= 0xa786)
672      return C | 1;
673    // LATIN CAPITAL LETTER SALTILLO
674    if (C == 0xa78b)
675      return 0xa78c;
676    // LATIN CAPITAL LETTER TURNED H
677    if (C == 0xa78d)
678      return 0x0265;
679    if (C < 0xa790)
680      return C;
681    // 2 characters
682    if (C <= 0xa792)
683      return C | 1;
684    if (C < 0xa796)
685      return C;
686    // 10 characters
687    if (C <= 0xa7a8)
688      return C | 1;
689    // LATIN CAPITAL LETTER H WITH HOOK
690    if (C == 0xa7aa)
691      return 0x0266;
692    // LATIN CAPITAL LETTER REVERSED OPEN E
693    if (C == 0xa7ab)
694      return 0x025c;
695    // LATIN CAPITAL LETTER SCRIPT G
696    if (C == 0xa7ac)
697      return 0x0261;
698    // LATIN CAPITAL LETTER L WITH BELT
699    if (C == 0xa7ad)
700      return 0x026c;
701    // LATIN CAPITAL LETTER SMALL CAPITAL I
702    if (C == 0xa7ae)
703      return 0x026a;
704    // LATIN CAPITAL LETTER TURNED K
705    if (C == 0xa7b0)
706      return 0x029e;
707    // LATIN CAPITAL LETTER TURNED T
708    if (C == 0xa7b1)
709      return 0x0287;
710    // LATIN CAPITAL LETTER J WITH CROSSED-TAIL
711    if (C == 0xa7b2)
712      return 0x029d;
713    // LATIN CAPITAL LETTER CHI
714    if (C == 0xa7b3)
715      return 0xab53;
716    if (C < 0xa7b4)
717      return C;
718    // 8 characters
719    if (C <= 0xa7c2)
720      return C | 1;
721    // LATIN CAPITAL LETTER C WITH PALATAL HOOK
722    if (C == 0xa7c4)
723      return 0xa794;
724    // LATIN CAPITAL LETTER S WITH HOOK
725    if (C == 0xa7c5)
726      return 0x0282;
727    // LATIN CAPITAL LETTER Z WITH PALATAL HOOK
728    if (C == 0xa7c6)
729      return 0x1d8e;
730    if (C < 0xa7c7)
731      return C;
732    // 2 characters
733    if (C <= 0xa7c9 && C % 2 == 1)
734      return C + 1;
735    if (C < 0xa7d0)
736      return C;
737    // 2 characters
738    if (C <= 0xa7d6 && C % 6 == 0)
739      return C + 1;
740    if (C < 0xa7d8)
741      return C;
742    // 2 characters
743    if (C <= 0xa7f5 && C % 29 == 19)
744      return C + 1;
745    if (C < 0xab70)
746      return C;
747    // 80 characters
748    if (C <= 0xabbf)
749      return C + -38864;
750    // LATIN SMALL LIGATURE LONG S T
751    if (C == 0xfb05)
752      return 0xfb06;
753    if (C < 0xff21)
754      return C;
755    // 26 characters
756    if (C <= 0xff3a)
757      return C + 32;
758    if (C < 0x10400)
759      return C;
760    // 40 characters
761    if (C <= 0x10427)
762      return C + 40;
763    if (C < 0x104b0)
764      return C;
765    // 36 characters
766    if (C <= 0x104d3)
767      return C + 40;
768    if (C < 0x10570)
769      return C;
770    // 11 characters
771    if (C <= 0x1057a)
772      return C + 39;
773    if (C < 0x1057c)
774      return C;
775    // 15 characters
776    if (C <= 0x1058a)
777      return C + 39;
778    if (C < 0x1058c)
779      return C;
780    // 7 characters
781    if (C <= 0x10592)
782      return C + 39;
783    if (C < 0x10594)
784      return C;
785    // 2 characters
786    if (C <= 0x10595)
787      return C + 39;
788    if (C < 0x10c80)
789      return C;
790    // 51 characters
791    if (C <= 0x10cb2)
792      return C + 64;
793    if (C < 0x118a0)
794      return C;
795    // 32 characters
796    if (C <= 0x118bf)
797      return C + 32;
798    if (C < 0x16e40)
799      return C;
800    // 32 characters
801    if (C <= 0x16e5f)
802      return C + 32;
803    if (C < 0x1e900)
804      return C;
805    // 34 characters
806    if (C <= 0x1e921)
807      return C + 34;
808  
809    return C;
810  }
811