1/*
2 * Copyright (c) 2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1.  Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 * 2.  Redistributions in binary form must reproduce the above copyright
13 *     notice, this list of conditions and the following disclaimer in the
14 *     documentation and/or other materials provided with the distribution.
15 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of its
16 *     contributors may be used to endorse or promote products derived from
17 *     this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Portions of this software have been released under the following terms:
31 *
32 * (c) Copyright 1989-1993 OPEN SOFTWARE FOUNDATION, INC.
33 * (c) Copyright 1989-1993 HEWLETT-PACKARD COMPANY
34 * (c) Copyright 1989-1993 DIGITAL EQUIPMENT CORPORATION
35 *
36 * To anyone who acknowledges that this file is provided "AS IS"
37 * without any express or implied warranty:
38 * permission to use, copy, modify, and distribute this file for any
39 * purpose is hereby granted without fee, provided that the above
40 * copyright notices and this notice appears in all source code copies,
41 * and that none of the names of Open Software Foundation, Inc., Hewlett-
42 * Packard Company or Digital Equipment Corporation be used
43 * in advertising or publicity pertaining to distribution of the software
44 * without specific, written prior permission.  Neither Open Software
45 * Foundation, Inc., Hewlett-Packard Company nor Digital
46 * Equipment Corporation makes any representations about the suitability
47 * of this software for any purpose.
48 *
49 * Copyright (c) 2007, Novell, Inc. All rights reserved.
50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions
52 * are met:
53 *
54 * 1.  Redistributions of source code must retain the above copyright
55 *     notice, this list of conditions and the following disclaimer.
56 * 2.  Redistributions in binary form must reproduce the above copyright
57 *     notice, this list of conditions and the following disclaimer in the
58 *     documentation and/or other materials provided with the distribution.
59 * 3.  Neither the name of Novell Inc. nor the names of its contributors
60 *     may be used to endorse or promote products derived from this
61 *     this software without specific prior written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
64 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
65 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
66 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY
67 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
68 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
69 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
70 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
72 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73 *
74 * @APPLE_LICENSE_HEADER_END@
75 */
76
77/*
78**
79**
80**  NAME:
81**
82**      cvt_glob.c
83**
84**  FACILITY:
85**
86**      IDL Stub Runtime Support
87**
88**  ABSTRACT:
89**
90**  Global data used by floating point conversion routines.
91**
92**  VERSION: DCE 1.0
93**
94*/
95#if HAVE_CONFIG_H
96#include <config.h>
97#endif
98
99#include <cvt.h>
100#include <cvt_pvt.h>
101
102#if (NDR_LOCAL_INT_REP != ndr_c_int_big_endian)
103
104idl_ulong_int vax_c[] = {
105
106        0x00008000, 0x00000000, 0x00000000, 0x00000000,         /* ROPs */
107        0x00000000, 0x00000000, 0x00000000, 0x00000000,         /* zeros */
108        0xffff7fff, 0xffffffff, 0xffffffff, 0xffffffff,         /* +huge */
109        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,         /* -huge */
110
111};
112
113idl_ulong_int ieee_s[] = {
114
115        0x7fbfffff,             /* little endian ieee s nan */
116        0xffffbf7f,             /* big endian ieee s nan */
117        0x00000000,             /* le ieee s +zero */
118        0x00000000,             /* be ieee s +zero */
119        0x80000000,             /* le ieee s -zero */
120        0x00000080,             /* be ieee s -zero */
121        0x7f7fffff,             /* le ieee s +huge */
122        0xffff7f7f,             /* be ieee s +huge */
123        0xff7fffff,             /* le ieee s -huge */
124        0xffff7fff,             /* be ieee s -huge */
125        0x7f800000,             /* le ieee s +infinity */
126        0x0000807f,             /* be ieee s +infinity */
127        0xff800000,             /* le ieee s -infinity */
128        0x000080ff,             /* be ieee s -infinity */
129
130};
131
132idl_ulong_int ieee_t[] = {
133
134        0xffffffff, 0x7ff7ffff,         /* le ieee t nan */
135        0xfffff77f, 0xffffffff,         /* be ieee t nan */
136        0x00000000, 0x00000000,         /* le ieee t +zero */
137        0x00000000, 0x00000000,         /* be ieee t +zero */
138        0x00000000, 0x80000000,         /* le ieee t -zero */
139        0x00000080, 0x00000000,         /* be ieee t -zero */
140        0xffffffff, 0x7fefffff,         /* le ieee s +huge */
141        0xffffef7f, 0xffffffff,         /* be ieee s +huge */
142        0xffffffff, 0xffefffff,         /* le ieee s -huge */
143        0xffffefff, 0xffffffff,         /* be ieee s -huge */
144        0x00000000, 0x7ff00000,         /* le ieee t +infinity */
145        0x0000f07f, 0x00000000,         /* be ieee t +infinity */
146        0x00000000, 0xfff00000,         /* le ieee t -infinity */
147        0x0000f0ff, 0x00000000,         /* be ieee t -infinity */
148
149};
150
151idl_ulong_int ibm_s[] = {
152
153   0x000000ff,          /* ibm s invalid */
154   0x00000000,          /* ibm s +zero */
155   0x00000080,          /* ibm s -zero */
156   0xffffff7f,          /* ibm s +huge */
157   0xffffffff,          /* ibm s -huge */
158   0xffffff7f,          /* ibm s +infinity */
159   0xffffffff,          /* ibm s -infinity */
160
161};
162
163idl_ulong_int ibm_l[] = {
164
165   0x000000ff, 0x00000000,              /* ibm t invalid */
166   0x00000000, 0x00000000,              /* ibm t +zero */
167   0x00000080, 0x00000000,              /* ibm t -zero */
168   0xffffff7f, 0xffffffff,              /* ibm t +huge */
169   0xffffffff, 0xffffffff,              /* ibm t -huge */
170   0xffffff7f, 0xffffffff,              /* ibm t +infinity */
171   0xffffffff, 0xffffffff,              /* ibm t -infinity */
172
173};
174
175idl_ulong_int cray[] = {
176
177        0x00000060, 0x00000000,         /* cray invalid */
178        0x00000000, 0x00000000,         /* cray +zero */
179        0x00000080, 0x00000000,         /* cray -zero */
180        0xffffff5f, 0xffffffff,         /* cray +huge */
181        0xffffffdf, 0xffffffff,         /* cray -huge */
182        0x00000060, 0x00000000,         /* cray +infinity */
183        0x000000e0, 0x00000000,         /* cray -infinity */
184
185};
186
187idl_ulong_int int_c[] = {
188
189        0x00000000,             /* le int nan */
190        0x00000000,             /* be int nan */
191        0x00000000,             /* le int zero */
192        0x00000000,             /* be int zero */
193        0x7fffffff,             /* le int +huge */
194        0xffffff7f,             /* be int +huge */
195        0x80000000,             /* le int -huge */
196        0x00000080,             /* be int -huge */
197        0x7fffffff,             /* le int +infinity */
198        0xffffff7f,             /* be int +infinity */
199        0x80000000,             /* le int -infinity */
200        0x00000080,             /* be int -infinity */
201
202};
203
204#else /* Big-endian Data */
205
206idl_ulong_int vax_c[] = {
207
208        0x00800000, 0x00000000, 0x00000000, 0x00000000,         /* ROPs */
209        0x00000000, 0x00000000, 0x00000000, 0x00000000,         /* zeros */
210        0xff7fffff, 0xffffffff, 0xffffffff, 0xffffffff,         /* +huge */
211        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,         /* -huge */
212
213};
214
215idl_ulong_int ieee_s[] = {
216
217        0xffffbf7f,             /* little endian ieee s nan */
218        0x7fbfffff,             /* big endian ieee s nan */
219        0x00000000,             /* le ieee s +zero */
220        0x00000000,             /* be ieee s +zero */
221        0x00000080,             /* le ieee s -zero */
222        0x80000000,             /* be ieee s -zero */
223        0xffff7f7f,             /* le ieee s +huge */
224        0x7f7fffff,             /* be ieee s +huge */
225        0xffff7fff,             /* le ieee s -huge */
226        0xff7fffff,             /* be ieee s -huge */
227        0x0000807f,             /* le ieee s +infinity */
228        0x7f800000,             /* be ieee s +infinity */
229        0x000080ff,             /* le ieee s -infinity */
230        0xff800000,             /* be ieee s -infinity */
231
232};
233
234idl_ulong_int ieee_t[] = {
235
236        0xffffffff, 0xfffff77f,         /* le ieee t nan */
237        0x7ff7ffff, 0xffffffff,         /* be ieee t nan */
238        0x00000000, 0x00000000,         /* le ieee t +zero */
239        0x00000000, 0x00000000,         /* be ieee t +zero */
240        0x00000000, 0x00000080,         /* le ieee t -zero */
241        0x80000000, 0x00000000,         /* be ieee t -zero */
242        0xffffffff, 0xffffef7f,         /* le ieee s +huge */
243        0x7fefffff, 0xffffffff,         /* be ieee s +huge */
244        0xffffffff, 0xffffefff,         /* le ieee s -huge */
245        0xffefffff, 0xffffffff,         /* be ieee s -huge */
246        0x00000000, 0x0000f07f,         /* le ieee t +infinity */
247        0x7ff00000, 0x00000000,         /* be ieee t +infinity */
248        0x00000000, 0x0000f0ff,         /* le ieee t -infinity */
249        0xfff00000, 0x00000000,         /* be ieee t -infinity */
250
251};
252
253idl_ulong_int ibm_s[] = {
254
255   0xff000000,          /* ibm s invalid */
256   0x00000000,          /* ibm s +zero */
257   0x80000000,          /* ibm s -zero */
258   0x7fffffff,          /* ibm s +huge */
259   0xffffffff,          /* ibm s -huge */
260   0x7fffffff,          /* ibm s +infinity */
261   0xffffffff,          /* ibm s -infinity */
262
263};
264
265idl_ulong_int ibm_l[] = {
266
267   0xff000000, 0x00000000,              /* ibm t invalid */
268   0x00000000, 0x00000000,              /* ibm t +zero */
269   0x80000000, 0x00000000,              /* ibm t -zero */
270   0x7fffffff, 0xffffffff,              /* ibm t +huge */
271   0xffffffff, 0xffffffff,              /* ibm t -huge */
272   0x7fffffff, 0xffffffff,              /* ibm t +infinity */
273   0xffffffff, 0xffffffff,              /* ibm t -infinity */
274
275};
276
277idl_ulong_int cray[] = {
278
279        0x60000000, 0x00000000,         /* cray invalid */
280        0x00000000, 0x00000000,         /* cray +zero */
281        0x80000000, 0x00000000,         /* cray -zero */
282        0x5fffffff, 0xffffffff,         /* cray +huge */
283        0xdfffffff, 0xffffffff,         /* cray -huge */
284        0x60000000, 0x00000000,         /* cray +infinity */
285        0xe0000000, 0x00000000,         /* cray -infinity */
286
287};
288
289idl_ulong_int int_c[] = {
290
291        0x00000000,             /* le int nan */
292        0x00000000,             /* be int nan */
293        0x00000000,             /* le int zero */
294        0x00000000,             /* be int zero */
295        0xffffff7f,             /* le int +huge */
296        0x7fffffff,             /* be int +huge */
297        0x00000080,             /* le int -huge */
298        0x80000000,             /* be int -huge */
299        0xffffff7f,             /* le int +infinity */
300        0x7fffffff,             /* be int +infinity */
301        0x00000080,             /* le int -infinity */
302        0x80000000,             /* be int -infinity */
303
304};
305
306#endif /* Big-Endian Data */
307