* objc/objc-act.c: Fix comment typos.
[official-gcc.git] / libdecnumber / decLibrary.c
blobf757ffa67d0ff05519fdcb44eb65627b7033f0e7
1 /* Temporary library support for decimal floating point.
2 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA. */
21 #include "config.h"
22 #include "decContext.h"
23 #include "decimal128.h"
24 #include "decimal64.h"
25 #include "decimal32.h"
27 void __host_to_ieee_32 (_Decimal32, decimal32 *);
28 void __host_to_ieee_64 (_Decimal64, decimal64 *);
29 void __host_to_ieee_128 (_Decimal128, decimal128 *);
31 extern int isinfd32 (_Decimal32);
32 extern int isinfd64 (_Decimal64);
33 extern int isinfd128 (_Decimal128);
34 uint32_t __dec_byte_swap (uint32_t);
36 int
37 isinfd32 (_Decimal32 arg)
39 decNumber dn;
40 decimal32 d32;
42 __host_to_ieee_32 (arg, &d32);
43 decimal32ToNumber (&d32, &dn);
44 return (decNumberIsInfinite (&dn));
47 int
48 isinfd64 (_Decimal64 arg)
50 decNumber dn;
51 decimal64 d64;
53 __host_to_ieee_64 (arg, &d64);
54 decimal64ToNumber (&d64, &dn);
55 return (decNumberIsInfinite (&dn));
58 int
59 isinfd128 (_Decimal128 arg)
61 decNumber dn;
62 decimal128 d128;
64 __host_to_ieee_128 (arg, &d128);
65 decimal128ToNumber (&d128, &dn);
66 return (decNumberIsInfinite (&dn));
69 uint32_t
70 __dec_byte_swap (uint32_t in)
72 uint32_t out = 0;
73 unsigned char *p = (unsigned char *) &out;
74 union {
75 uint32_t i;
76 unsigned char b[4];
77 } u;
79 u.i = in;
80 p[0] = u.b[3];
81 p[1] = u.b[2];
82 p[2] = u.b[1];
83 p[3] = u.b[0];
85 return out;