[Gmp-commit] /var/hg/gmp: Avoid left shift of negative value in tests.

mercurial at gmplib.org mercurial at gmplib.org
Thu Nov 24 23:14:20 UTC 2016


details:   /var/hg/gmp/rev/504ea841a52b
changeset: 17135:504ea841a52b
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Fri Nov 25 00:14:18 2016 +0100
description:
Avoid left shift of negative value in tests.

diffstat:

 ChangeLog            |  4 ++++
 tests/cxx/t-ops2z.cc |  2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r fbc88b42a197 -r 504ea841a52b ChangeLog
--- a/ChangeLog	Thu Nov 24 19:34:11 2016 +0100
+++ b/ChangeLog	Fri Nov 25 00:14:18 2016 +0100
@@ -1,3 +1,7 @@
+2016-11-25  Marc Glisse  <marc.glisse at inria.fr>
+
+	* tests/cxx/t-ops2z.cc (checkz): Avoid left shift of negative number.
+
 2016-11-22  Torbjörn Granlund  <tg at gmplib.org>
 
 	* configure.ac (x86): Define LINUX for GNU/Linux systems.
diff -r fbc88b42a197 -r 504ea841a52b tests/cxx/t-ops2z.cc
--- a/tests/cxx/t-ops2z.cc	Thu Nov 24 19:34:11 2016 +0100
+++ b/tests/cxx/t-ops2z.cc	Fri Nov 25 00:14:18 2016 +0100
@@ -46,7 +46,7 @@
   CHECK_ALL(mpz_class,6,3,^);
   CHECK(mpz_class,unsigned long,6,2,<<);
   CHECK(mpz_class,unsigned long,6,2,>>);
-  CHECK(mpz_class,unsigned long,-13,2,<<);
+  ASSERT_ALWAYS(mpz_class(-13)<<(unsigned long)2 == (-13)*4);
   CHECK(mpz_class,unsigned long,-13,2,>>);
   ASSERT_ALWAYS(++mpz_class(7)==8);
   ASSERT_ALWAYS(++mpz_class(-8)==-7);


More information about the gmp-commit mailing list