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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [unsorted/] [udconvert.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
double
2
unsigned_to_double1 (u)
3
     unsigned u;
4
{
5
  double d;
6
  d = (int) u;                  /* convert as from a *signed* integer */
7
  return ((int) u < 0)
8
    ? d + 4294967296.0
9
      : d;
10
}
11
 
12
/* Alternatively */
13
 
14
double
15
unsigned_to_double2 (u)
16
     unsigned u;
17
{
18
  double d;
19
  u -= 2147483648;              /* complement sign bit */
20
  d = (int) u;                  /* convert as from a *signed* integer */
21
  return d + 2147483648.0;
22
}
23
 
24
unsigned
25
double_to_unsigned (d)
26
     double d;
27
{
28
  d += 2147483648.0;
29
  return ((int) d) - 2147483648;
30
}

powered by: WebSVN 2.1.0

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