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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [991228-1.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 688 jeremybenn
__extension__ union { double d; int i[2]; } u = { d: -0.25 };
2
 
3
/* This assumes the endianness of words in a long long is the same as
4
   that for doubles, which doesn't hold for a few platforms, but we
5
   can probably special case them here, as appropriate.  */
6
long long endianness_test = 1;
7
#define MSW (*(int*)&endianness_test)
8
 
9
int
10
signbit(double x)
11
{
12
  __extension__ union { double d; int i[2]; } u = { d: x };
13
  return u.i[MSW] < 0;
14
}
15
 
16
int main(void)
17
{
18
  if (2*sizeof(int) != sizeof(double) || u.i[MSW] >= 0)
19
    exit(0);
20
 
21
  if (!signbit(-0.25))
22
    abort();
23
 
24
  exit(0);
25
}

powered by: WebSVN 2.1.0

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