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