Replace 8388608.0 with HALFRAD in mp code
[glibc.git] / iconvdata / iso_11548-1.c
blobde70529198f003dd809ba861173b7aabab78614b
1 /* Conversion to and from ISO 11548-1.
2 Copyright (C) 1997-2013 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997,
5 Samuel Thibault <samuel.thibault@ens-lyon.org>, 2005.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
21 #include <dlfcn.h>
22 #include <stdint.h>
24 /* Definitions used in the body of the `gconv' function. */
25 #define CHARSET_NAME "ISO_11548-1//"
26 #define FROM_LOOP from_iso11548_1
27 #define TO_LOOP to_iso11548_1
28 #define DEFINE_INIT 1
29 #define DEFINE_FINI 1
30 #define MIN_NEEDED_FROM 1
31 #define MIN_NEEDED_TO 4
33 #define BRAILLE_UCS_BASE 0x2800
35 /* First define the conversion function from ISO 11548-1 to UCS4. */
36 #define MIN_NEEDED_INPUT MIN_NEEDED_FROM
37 #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
38 #define LOOPFCT FROM_LOOP
39 #define BODY \
40 *((uint32_t *) outptr) = BRAILLE_UCS_BASE | (*inptr++); \
41 outptr += sizeof (uint32_t);
42 #define ONEBYTE_BODY \
43 { \
44 return BRAILLE_UCS_BASE | c; \
46 #include <iconv/loop.c>
49 /* Next, define the other direction. */
50 #define MIN_NEEDED_INPUT MIN_NEEDED_TO
51 #define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
52 #define LOOPFCT TO_LOOP
53 #define BODY \
54 { \
55 uint32_t ch = *((const uint32_t *) inptr); \
56 if (__builtin_expect ((ch & 0xffffff00u) != BRAILLE_UCS_BASE, 0)) \
57 { \
58 UNICODE_TAG_HANDLER (ch, 4); \
60 /* We have an illegal character. */ \
61 STANDARD_TO_LOOP_ERR_HANDLER (4); \
62 } \
63 else \
64 *outptr++ = (unsigned char) (ch & 0xff); \
65 inptr += 4; \
67 #define LOOP_NEED_FLAGS
68 #include <iconv/loop.c>
71 /* Now define the toplevel functions. */
72 #include <iconv/skeleton.c>