OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [libdecnumber/] [decLibrary.c] - Blame information for rev 301

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Temporary library support for decimal floating point.
2
   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3
 
4
   This file is part of GCC.
5
 
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.
10
 
11
   In addition to the permissions in the GNU General Public License,
12
   the Free Software Foundation gives you unlimited permission to link
13
   the compiled version of this file into combinations with other
14
   programs, and to distribute those combinations without any
15
   restriction coming from the use of this file.  (The General Public
16
   License restrictions do apply in other respects; for example, they
17
   cover modification of the file, and distribution when not linked
18
   into a combine executable.)
19
 
20
   GCC is distributed in the hope that it will be useful, but WITHOUT
21
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
23
   License for more details.
24
 
25
   You should have received a copy of the GNU General Public License
26
   along with GCC; see the file COPYING.  If not, write to the Free
27
   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
28
   02110-1301, USA.  */
29
 
30
#include "config.h"
31
#include "decContext.h"
32
#include "decimal128.h"
33
#include "decimal64.h"
34
#include "decimal32.h"
35
 
36
void __host_to_ieee_32 (_Decimal32, decimal32 *);
37
void __host_to_ieee_64 (_Decimal64, decimal64 *);
38
void __host_to_ieee_128 (_Decimal128, decimal128 *);
39
 
40
extern int isinfd32 (_Decimal32);
41
extern int isinfd64 (_Decimal64);
42
extern int isinfd128 (_Decimal128);
43
extern void __dfp_enable_traps (void);
44
extern void __dfp_raise (int exception __attribute__ ((unused)));
45
 
46
int
47
isinfd32 (_Decimal32 arg)
48
{
49
  decNumber dn;
50
  decimal32 d32;
51
 
52
  __host_to_ieee_32 (arg, &d32);
53
  decimal32ToNumber (&d32, &dn);
54
  return (decNumberIsInfinite (&dn));
55
}
56
 
57
int
58
isinfd64 (_Decimal64 arg)
59
{
60
  decNumber dn;
61
  decimal64 d64;
62
 
63
  __host_to_ieee_64 (arg, &d64);
64
  decimal64ToNumber (&d64, &dn);
65
  return (decNumberIsInfinite (&dn));
66
}
67
 
68
int
69
isinfd128 (_Decimal128 arg)
70
{
71
  decNumber dn;
72
  decimal128 d128;
73
 
74
  __host_to_ieee_128 (arg, &d128);
75
  decimal128ToNumber (&d128, &dn);
76
  return (decNumberIsInfinite (&dn));
77
}
78
 
79
int __dfp_traps;
80
 
81
void
82
__dfp_enable_traps (void)
83
{
84
  __dfp_traps = 1;
85
}
86
 
87
void
88
__dfp_raise (int exception __attribute__ ((unused)))
89
{
90
  raise (SIGFPE);
91
}
92
 
93
uint32_t
94
__dec_byte_swap (uint32_t in)
95
{
96
  uint32_t out = 0;
97
  unsigned char *p = (unsigned char *) &out;
98
  union {
99
    uint32_t i;
100
    unsigned char b[4];
101
  } u;
102
 
103
  u.i = in;
104
  p[0] = u.b[3];
105
  p[1] = u.b[2];
106
  p[2] = u.b[1];
107
  p[3] = u.b[0];
108
 
109
  return out;
110
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.