4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1987 by Sun Microsystems, Inc.
32 /* Convert double to unsigned. */
37 * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN
38 * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of
39 * converting 2**31 <= d < 2**32 is unknown, adjust d before the
43 if (d
>= 2147483648.0)
44 id
= 0x80000000 | (int) (d
- 2147483648.0);
52 int dd
; /* really float */
54 /* Convert float to unsigned. */
57 double d
= (double) *((float *)(&dd
));
59 * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN
60 * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of
61 * converting 2**31 <= d < 2**32 is unknown, adjust d before the
65 if (d
>= 2147483648.0)
66 id
= 0x80000000 | (int) (d
- 2147483648.0);