:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / crtdll / mbstring / jmstojis.c
1 #include <crtdll/mbstring.h>
2
3 unsigned short _mbcjmstojis(unsigned short c)
4 {
5   int c1, c2;
6
7   c2 = (unsigned char)c;
8   c1 = c >> 8;
9   if (c1 < 0xf0 && _ismbblead(c1) && _ismbbtrail(c2)) {
10     if (c1 >= 0xe0)
11       c1 -= 0x40;
12     c1 -= 0x70;
13     c1 <<= 1;
14     if (c2 < 0x9f) {
15       c1 --;
16       c2 -= 0x1f;
17       if (c2 >= (0x80-0x1f))
18         c2 --;
19     } else {
20       c2 -= 0x7e;
21     }
22     return ((c1 << 8) | c2);
23   }
24   return 0;
25 }