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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.c-torture/] [unsorted/] [udconvert.c] - Rev 12

Compare with Previous | Blame | View Log

double
unsigned_to_double1 (u)
     unsigned u;
{
  double d;
  d = (int) u;			/* convert as from a *signed* integer */
  return ((int) u < 0)
    ? d + 4294967296.0
      : d;
}
 
/* Alternatively */
 
double
unsigned_to_double2 (u)
     unsigned u;
{
  double d;
  u -= 2147483648;		/* complement sign bit */
  d = (int) u;			/* convert as from a *signed* integer */
  return d + 2147483648.0;
}
 
unsigned
double_to_unsigned (d)
     double d;
{
  d += 2147483648.0;
  return ((int) d) - 2147483648;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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