mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-19 09:58:59 +08:00
991228-1.c: Take word endianness into account.
* gcc.c-torture/execute/991228-1.c: Take word endianness into account. From-SVN: r38725
This commit is contained in:
parent
cc1fe44fe8
commit
336bc4aede
@ -1,3 +1,8 @@
|
||||
2001-01-05 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* gcc.c-torture/execute/991228-1.c: Take word endianness into
|
||||
account.
|
||||
|
||||
2001-01-05 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gcc.c-torture/execute/builtin-complex-1.c: New test.
|
||||
|
@ -1,15 +1,21 @@
|
||||
__extension__ union { double d; int i[2]; } u = { d: -0.25 };
|
||||
|
||||
/* This assumes the endianness of words in a long long is the same as
|
||||
that for doubles, which doesn't hold for a few platforms, but we
|
||||
can probably special case them here, as appropriate. */
|
||||
long long endianness_test = 1;
|
||||
#define MSW (*(int*)&endianness_test)
|
||||
|
||||
int
|
||||
signbit(double x)
|
||||
{
|
||||
__extension__ union { double d; int i[2]; } u = { d: x };
|
||||
return u.i[0] < 0;
|
||||
return u.i[MSW] < 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (2*sizeof(int) != sizeof(double) || u.i[0] >= 0)
|
||||
if (2*sizeof(int) != sizeof(double) || u.i[MSW] >= 0)
|
||||
exit(0);
|
||||
|
||||
if (!signbit(-0.25))
|
||||
|
Loading…
Reference in New Issue
Block a user