[PPL-devel] [GIT] ppl/ppl(master): Improved subset_or_equal(const Bit_Row&, const Bit_Row&, bool&).
Roberto Bagnara
bagnara at cs.unipr.it
Mon Apr 20 10:38:03 CEST 2009
Module: ppl/ppl
Branch: master
Commit: 33cd6b46113c1db583a43eccf9e0a9076018948a
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=33cd6b46113c1db583a43eccf9e0a9076018948a
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Mon Apr 20 10:37:36 2009 +0200
Improved subset_or_equal(const Bit_Row&, const Bit_Row&, bool&).
---
src/Bit_Row.cc | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/Bit_Row.cc b/src/Bit_Row.cc
index 32a3ff0..688fff8 100644
--- a/src/Bit_Row.cc
+++ b/src/Bit_Row.cc
@@ -279,16 +279,33 @@ PPL::subset_or_equal(const Bit_Row& x, const Bit_Row& y,
assert(y_size >= 0);
if (x_size > y_size)
return false;
- strict_subset = (x_size < y_size);
mp_srcptr xp = x.vec->_mp_d;
mp_srcptr yp = y.vec->_mp_d;
+ strict_subset = (x_size < y_size);
+ if (strict_subset)
+ goto strict_subset_loop;
+
while (x_size > 0) {
const mp_limb_t xl = *xp;
const mp_limb_t yl = *yp;
if (xl & ~yl)
return false;
- if (!strict_subset && xl != yl)
+ ++xp;
+ ++yp;
+ --x_size;
+ if (xl != yl) {
strict_subset = true;
+ goto strict_subset_loop;
+ }
+ }
+ return true;
+
+ strict_subset_loop:
+ while (x_size > 0) {
+ const mp_limb_t xl = *xp;
+ const mp_limb_t yl = *yp;
+ if (xl & ~yl)
+ return false;
++xp;
++yp;
--x_size;
More information about the PPL-devel
mailing list