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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [libiberty/] [copysign.c] - Diff between revs 156 and 816

Only display areas with differences | Details | Blame | View Log

Rev 156 Rev 816
#include <ansidecl.h>
#include <ansidecl.h>
 
 
#ifdef __IEEE_BIG_ENDIAN
#ifdef __IEEE_BIG_ENDIAN
 
 
typedef union
typedef union
{
{
  double value;
  double value;
  struct
  struct
  {
  {
    unsigned int sign : 1;
    unsigned int sign : 1;
    unsigned int exponent: 11;
    unsigned int exponent: 11;
    unsigned int fraction0:4;
    unsigned int fraction0:4;
    unsigned int fraction1:16;
    unsigned int fraction1:16;
    unsigned int fraction2:16;
    unsigned int fraction2:16;
    unsigned int fraction3:16;
    unsigned int fraction3:16;
 
 
  } number;
  } number;
  struct
  struct
  {
  {
    unsigned int sign : 1;
    unsigned int sign : 1;
    unsigned int exponent: 11;
    unsigned int exponent: 11;
    unsigned int quiet:1;
    unsigned int quiet:1;
    unsigned int function0:3;
    unsigned int function0:3;
    unsigned int function1:16;
    unsigned int function1:16;
    unsigned int function2:16;
    unsigned int function2:16;
    unsigned int function3:16;
    unsigned int function3:16;
  } nan;
  } nan;
  struct
  struct
  {
  {
    unsigned long msw;
    unsigned long msw;
    unsigned long lsw;
    unsigned long lsw;
  } parts;
  } parts;
    long aslong[2];
    long aslong[2];
} __ieee_double_shape_type;
} __ieee_double_shape_type;
 
 
#endif
#endif
 
 
#ifdef __IEEE_LITTLE_ENDIAN
#ifdef __IEEE_LITTLE_ENDIAN
 
 
typedef union
typedef union
{
{
  double value;
  double value;
  struct
  struct
  {
  {
#ifdef __SMALL_BITFIELDS
#ifdef __SMALL_BITFIELDS
    unsigned int fraction3:16;
    unsigned int fraction3:16;
    unsigned int fraction2:16;
    unsigned int fraction2:16;
    unsigned int fraction1:16;
    unsigned int fraction1:16;
    unsigned int fraction0: 4;
    unsigned int fraction0: 4;
#else
#else
    unsigned int fraction1:32;
    unsigned int fraction1:32;
    unsigned int fraction0:20;
    unsigned int fraction0:20;
#endif
#endif
    unsigned int exponent :11;
    unsigned int exponent :11;
    unsigned int sign     : 1;
    unsigned int sign     : 1;
  } number;
  } number;
  struct
  struct
  {
  {
#ifdef __SMALL_BITFIELDS
#ifdef __SMALL_BITFIELDS
    unsigned int function3:16;
    unsigned int function3:16;
    unsigned int function2:16;
    unsigned int function2:16;
    unsigned int function1:16;
    unsigned int function1:16;
    unsigned int function0:3;
    unsigned int function0:3;
#else
#else
    unsigned int function1:32;
    unsigned int function1:32;
    unsigned int function0:19;
    unsigned int function0:19;
#endif
#endif
    unsigned int quiet:1;
    unsigned int quiet:1;
    unsigned int exponent: 11;
    unsigned int exponent: 11;
    unsigned int sign : 1;
    unsigned int sign : 1;
  } nan;
  } nan;
  struct
  struct
  {
  {
    unsigned long lsw;
    unsigned long lsw;
    unsigned long msw;
    unsigned long msw;
  } parts;
  } parts;
 
 
  long aslong[2];
  long aslong[2];
 
 
} __ieee_double_shape_type;
} __ieee_double_shape_type;
 
 
#endif
#endif
 
 
#ifdef __IEEE_BIG_ENDIAN
#ifdef __IEEE_BIG_ENDIAN
typedef union
typedef union
{
{
  float value;
  float value;
  struct
  struct
  {
  {
    unsigned int sign : 1;
    unsigned int sign : 1;
    unsigned int exponent: 8;
    unsigned int exponent: 8;
    unsigned int fraction0: 7;
    unsigned int fraction0: 7;
    unsigned int fraction1: 16;
    unsigned int fraction1: 16;
  } number;
  } number;
  struct
  struct
  {
  {
    unsigned int sign:1;
    unsigned int sign:1;
    unsigned int exponent:8;
    unsigned int exponent:8;
    unsigned int quiet:1;
    unsigned int quiet:1;
    unsigned int function0:6;
    unsigned int function0:6;
    unsigned int function1:16;
    unsigned int function1:16;
  } nan;
  } nan;
  long p1;
  long p1;
 
 
} __ieee_float_shape_type;
} __ieee_float_shape_type;
#endif
#endif
 
 
#ifdef __IEEE_LITTLE_ENDIAN
#ifdef __IEEE_LITTLE_ENDIAN
typedef union
typedef union
{
{
  float value;
  float value;
  struct
  struct
  {
  {
    unsigned int fraction0: 7;
    unsigned int fraction0: 7;
    unsigned int fraction1: 16;
    unsigned int fraction1: 16;
    unsigned int exponent: 8;
    unsigned int exponent: 8;
    unsigned int sign : 1;
    unsigned int sign : 1;
  } number;
  } number;
  struct
  struct
  {
  {
    unsigned int function1:16;
    unsigned int function1:16;
    unsigned int function0:6;
    unsigned int function0:6;
    unsigned int quiet:1;
    unsigned int quiet:1;
    unsigned int exponent:8;
    unsigned int exponent:8;
    unsigned int sign:1;
    unsigned int sign:1;
  } nan;
  } nan;
  long p1;
  long p1;
 
 
} __ieee_float_shape_type;
} __ieee_float_shape_type;
#endif
#endif
 
 
#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN)
 
 
double
double
copysign (double x, double y)
copysign (double x, double y)
{
{
  __ieee_double_shape_type a,b;
  __ieee_double_shape_type a,b;
  b.value = y;
  b.value = y;
  a.value = x;
  a.value = x;
  a.number.sign =b.number.sign;
  a.number.sign =b.number.sign;
  return a.value;
  return a.value;
}
}
 
 
#else
#else
 
 
double
double
copysign (double x, double y)
copysign (double x, double y)
{
{
  if ((x < 0 && y > 0) || (x > 0 && y < 0))
  if ((x < 0 && y > 0) || (x > 0 && y < 0))
    return -x;
    return -x;
  return x;
  return x;
}
}
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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