[Gmp-commit] /var/hg/gmp-6.1: (tests_rand_start): Make shift well-defined.

mercurial at gmplib.org mercurial at gmplib.org
Thu Dec 1 21:56:08 UTC 2016


details:   /var/hg/gmp-6.1/rev/fca4931a7e96
changeset: 16961:fca4931a7e96
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu Dec 01 22:56:04 2016 +0100
description:
(tests_rand_start): Make shift well-defined.

diffstat:

 ChangeLog    |  2 ++
 tests/misc.c |  2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 3b1185d5cf77 -r fca4931a7e96 ChangeLog
--- a/ChangeLog	Thu Dec 01 16:05:05 2016 +0100
+++ b/ChangeLog	Thu Dec 01 22:56:04 2016 +0100
@@ -1,5 +1,7 @@
 2016-12-01  Torbjörn Granlund  <tg at gmplib.org>
 
+	* tests/misc.c (tests_rand_start): Make shift well-defined.
+
 	* Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
 	* gmp-h.in: Bump version.
 
diff -r 3b1185d5cf77 -r fca4931a7e96 tests/misc.c
--- a/tests/misc.c	Thu Dec 01 16:05:05 2016 +0100
+++ b/tests/misc.c	Thu Dec 01 22:56:04 2016 +0100
@@ -116,7 +116,7 @@
 #if HAVE_GETTIMEOFDAY
           struct timeval  tv;
           gettimeofday (&tv, NULL);
-          seed = tv.tv_sec ^ (tv.tv_usec << 12);
+          seed = tv.tv_sec ^ ((unsigned long) tv.tv_usec << 12);
 	  seed &= 0xffffffff;
 #else
           time_t  tv;


More information about the gmp-commit mailing list