+2006-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #3747]
+ * stdlib/jrand48_r.c (__jrand48_r): Make sure result is in the
+ [-231 .. 231) range.
+ * stdlib/tst-rand48.c (main): Fix expected values for 64-bit
+ targets.
+ * stdlib/tst-rand48-2.c: New test.
+ * stdlib/Makefile (tests): Add tst-rand48-2.
+
2006-12-14 Jakub Jelinek <jakub@redhat.com>
* misc/tst-pselect.c (do_test): Fix sigblock argument.
-/* Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
return -1;
/* Store the result. */
- *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl;
+ *result = (int32_t) ((xsubi[2] << 16) | xsubi[1]);
return 0;
}
}
l = mrand48 ();
- if (l != 0xa28c1003l)
+ if (l != -0x5d73effdl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0xa28c1003l, l);
+ __LINE__ - 4, -0x5d73effdl, l);
result = 1;
}
}
l = mrand48 ();
- if (l != 0x9e88f474l)
+ if (l != -0x61770b8cl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0x9e88f474l, l);
+ __LINE__ - 4, -0x61770b8cl, l);
result = 1;
}
}
l = mrand48 ();
- if (l != 0xeb7a1fa3l)
+ if (l != -0x1485e05dl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0xeb7a1fa3l, l);
+ __LINE__ - 4, -0x1485e05dl, l);
result = 1;
}
}
l = mrand48 ();
- if (l != 0xa28c1003l)
+ if (l != -0x5d73effdl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0xa28c1003l, l);
+ __LINE__ - 4, -0x5d73effdl, l);
result = 1;
}
}
l = mrand48 ();
- if (l != 0x9e88f474l)
+ if (l != -0x61770b8cl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0x9e88f474l, l);
+ __LINE__ - 4, -0x61770b8cl, l);
result = 1;
}
}
l = mrand48 ();
- if (l != 0xeb7a1fa3l)
+ if (l != -0x1485e05dl)
{
printf ("mrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0xeb7a1fa3l, l);
+ __LINE__ - 4, -0x1485e05dl, l);
result = 1;
}
}
l = jrand48 (xs);
- if (l != 0xf568c7a0l)
+ if (l != -0xa973860l)
{
printf ("jrand48() in line %d failed: expected %lx, seen %lx\n",
- __LINE__ - 4, 0xf568c7a0l, l);
+ __LINE__ - 4, -0xa973860l, l);
result = 1;
}