]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #3747]
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Jan 2007 17:52:07 +0000 (17:52 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 12 Jan 2007 17:52:07 +0000 (17:52 +0000)
* 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.

ChangeLog
stdlib/Makefile
stdlib/jrand48_r.c
stdlib/tst-rand48.c

index fe2f7bf7b59db08bc912e44994a9cf9cd4de27ec..3470783d368861e07d65518359e8c270aca72f6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
index e632d3523b47bf553ce0f9e592a1080cb187d26e..4b802e2ed5c069b0399884d8d5183296bdb9d8dd 100644 (file)
@@ -66,7 +66,8 @@ tests         := tst-strtol tst-strtod testmb testrand testsort testdiv   \
                   test-canon test-canon2 tst-strtoll tst-environ           \
                   tst-xpg-basename tst-random tst-random2 tst-bsearch      \
                   tst-limits tst-rand48 bug-strtod tst-setcontext          \
-                  test-a64l tst-qsort tst-system testmb2 bug-strtod2
+                  test-a64l tst-qsort tst-system testmb2 bug-strtod2       \
+                  tst-rand48-2
 
 include ../Makeconfig
 
index 2383ae129e2bdb7936d44a15f687c66eb43068e2..39e8d090a684285c2fc9b5597804fbafb2b36986 100644 (file)
@@ -1,4 +1,4 @@
-/* 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.
 
@@ -30,7 +30,7 @@ __jrand48_r (xsubi, buffer, result)
     return -1;
 
   /* Store the result.  */
-  *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl;
+  *result = (int32_t) ((xsubi[2] << 16) | xsubi[1]);
 
   return 0;
 }
index fd2c4c1955fbf450b6a951367f0ea0ee53558ade..52e1b96afe2f1b501b4d4330da969d1ce4f7f109 100644 (file)
@@ -44,10 +44,10 @@ main (void)
     }
 
   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;
     }
 
@@ -60,10 +60,10 @@ main (void)
     }
 
   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;
     }
 
@@ -92,10 +92,10 @@ main (void)
     }
 
   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;
     }
 
@@ -171,10 +171,10 @@ main (void)
     }
 
   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;
     }
 
@@ -187,10 +187,10 @@ main (void)
     }
 
   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;
     }
 
@@ -231,10 +231,10 @@ main (void)
     }
 
   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;
     }
 
@@ -287,10 +287,10 @@ main (void)
     }
 
   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;
     }