]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Locale/__wctoint.h
NetworkPkg: Remove a CopyMem to speed up the HTTP boot download.
[mirror_edk2.git] / StdLib / LibC / Locale / __wctoint.h
CommitLineData
2aa62f2b 1/* $NetBSD: __wctoint.h,v 1.1 2001/09/28 11:25:37 yamt Exp $ */\r
2\r
3/*-\r
4 * Copyright (c)2001 Citrus Project,\r
5 * All rights reserved.\r
6 *\r
7 * Redistribution and use in source and binary forms, with or without\r
8 * modification, are permitted provided that the following conditions\r
9 * are met:\r
10 * 1. Redistributions of source code must retain the above copyright\r
11 * notice, this list of conditions and the following disclaimer.\r
12 * 2. Redistributions in binary form must reproduce the above copyright\r
13 * notice, this list of conditions and the following disclaimer in the\r
14 * documentation and/or other materials provided with the distribution.\r
15 *\r
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
26 * SUCH DAMAGE.\r
27 *\r
28 * $Citrus: xpg4dl/FreeBSD/lib/libc/locale/__wctoint.h,v 1.1 2001/09/21 13:52:32 yamt Exp $\r
29 */\r
30\r
31\r
32__inline static int\r
33__wctoint(wchar_t wc)\r
34{\r
35 int n;\r
36\r
37 /* XXX I expect compiler to optimize this. :D */\r
38 switch (wc) {\r
39 case L'0': n = 0; break;\r
40 case L'1': n = 1; break;\r
41 case L'2': n = 2; break;\r
42 case L'3': n = 3; break;\r
43 case L'4': n = 4; break;\r
44 case L'5': n = 5; break;\r
45 case L'6': n = 6; break;\r
46 case L'7': n = 7; break;\r
47 case L'8': n = 8; break;\r
48 case L'9': n = 9; break;\r
49 case L'A': case L'a': n = 10; break;\r
50 case L'B': case L'b': n = 11; break;\r
51 case L'C': case L'c': n = 12; break;\r
52 case L'D': case L'd': n = 13; break;\r
53 case L'E': case L'e': n = 14; break;\r
54 case L'F': case L'f': n = 15; break;\r
55 case L'G': case L'g': n = 16; break;\r
56 case L'H': case L'h': n = 17; break;\r
57 case L'I': case L'i': n = 18; break;\r
58 case L'J': case L'j': n = 19; break;\r
59 case L'K': case L'k': n = 20; break;\r
60 case L'L': case L'l': n = 21; break;\r
61 case L'M': case L'm': n = 22; break;\r
62 case L'N': case L'n': n = 23; break;\r
63 case L'O': case L'o': n = 24; break;\r
64 case L'P': case L'p': n = 25; break;\r
65 case L'Q': case L'q': n = 26; break;\r
66 case L'R': case L'r': n = 27; break;\r
67 case L'S': case L's': n = 28; break;\r
68 case L'T': case L't': n = 29; break;\r
69 case L'U': case L'u': n = 30; break;\r
70 case L'V': case L'v': n = 31; break;\r
71 case L'W': case L'w': n = 32; break;\r
72 case L'X': case L'x': n = 33; break;\r
73 case L'Y': case L'y': n = 34; break;\r
74 case L'Z': case L'z': n = 35; break;\r
75 default: n = -1; break; /* error */\r
76 }\r
77\r
78 return n;\r
79}\r