[PPL-devel] [GIT] ppl/ppl(master): Revert "Optimized smod_2exp_signed_int."

Abramo Bagnara abramo.bagnara at gmail.com
Tue May 4 13:11:36 CEST 2010


Module: ppl/ppl
Branch: master
Commit: 258de934add2e906ff2fb4ff768f11bf34e5fa75
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=258de934add2e906ff2fb4ff768f11bf34e5fa75

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Tue May  4 13:11:29 2010 +0200

Revert "Optimized smod_2exp_signed_int."

This reverts commit 21d120a07448821720acd415213f9b08a9a14338.

---

 src/checked_int.inlines.hh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/checked_int.inlines.hh b/src/checked_int.inlines.hh
index 6217dc7..79985cd 100644
--- a/src/checked_int.inlines.hh
+++ b/src/checked_int.inlines.hh
@@ -1310,8 +1310,8 @@ smod_2exp_signed_int(Type& to, const Type x, unsigned int exp,
   if (exp >= sizeof(Type) * CHAR_BIT)
     to = x;
   else {
-    Type m = -(Type(1) << (exp - 1));
-    to = (x + m) ^ m;
+    Type m = Type(1) << (exp - 1);
+    to = (x & (m - 1)) - (x & m);
   }
   return V_EQ;
 }




More information about the PPL-devel mailing list