[PPL-devel] [GIT] ppl/ppl(master): Optimized smod_2exp_signed_int.
Abramo Bagnara
abramo.bagnara at gmail.com
Tue May 4 13:07:48 CEST 2010
Module: ppl/ppl
Branch: master
Commit: 21d120a07448821720acd415213f9b08a9a14338
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=21d120a07448821720acd415213f9b08a9a14338
Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date: Tue May 4 13:07:37 2010 +0200
Optimized smod_2exp_signed_int.
---
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 79985cd..6217dc7 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 - 1)) - (x & m);
+ Type m = -(Type(1) << (exp - 1));
+ to = (x + m) ^ m;
}
return V_EQ;
}
More information about the PPL-devel
mailing list