[SCM] polybori: Polynomials over Boolean Rings branch, upstream-hg, updated. b4a5cffaa908c53e1d958a42110f8c4dad853aa3
Alexander Dreyer
adreyer at gmx.de
Fri Mar 23 08:01:47 UTC 2012
The following commit has been merged in the upstream-hg branch:
commit dee71916ed6f01a10d2e2db50a35f5cb7a1c274c
Author: Alexander Dreyer <adreyer at gmx.de>
Date: Tue Feb 28 15:38:19 2012 +0100
CHA: removed unused delayed product comparison
diff --git a/groebner/include/polybori/groebner/DelayedLongLong.h b/groebner/include/polybori/groebner/DelayedLongLong.h
deleted file mode 100644
index 855ffb2..0000000
--- a/groebner/include/polybori/groebner/DelayedLongLong.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- c++ -*-
-//*****************************************************************************
-/** @file DelayedLongLong.h
- *
- * @author Alexander Dreyer
- * @date 2012-02-23
- *
- * This file includes the definition of the class @c DelayedLongLong.
- *
- * @par Copyright:
- * (c) 2012 by The PolyBoRi Team
- *
-**/
-//*****************************************************************************
-
-#ifndef polybori_groebner_DelayedLongLong_h_
-#define polybori_groebner_DelayedLongLong_h_
-
-// include basic definitions
-#include "groebner_defs.h"
-#include "BitMask.h"
-
-BEGIN_NAMESPACE_PBORIGB
-
-/** @class DelayedLongLong
- * @brief This class unses two (unsigned) longs to represent @c long long.
- *
- **/
-
-class DelayedLongLong:
- protected std::pair<unsigned long, unsigned long>,
- protected BitMask<sizeof(unsigned long)*4> {
-
-public:
- typedef unsigned long long_type;
-
-protected:
- typedef std::pair<long_type, long_type> base;
-
-public:
- DelayedLongLong(const long_type& high, const long_type& low):
- base(high, low) {}
-
-#ifdef PBORI_HAVE_LONG_LONG
- operator unsigned long long() const {
- return (unsigned long long(first) << (sizeof(long_type)*8)) + second;
- }
-#endif
-};
-
-
-END_NAMESPACE_PBORIGB
-
-#endif /* polybori_groebner_DelayedLongLong_h_ */
diff --git a/groebner/include/polybori/groebner/DelayedLongProduct.h b/groebner/include/polybori/groebner/DelayedLongProduct.h
index 1e6dd31..f0cdc3f 100644
--- a/groebner/include/polybori/groebner/DelayedLongProduct.h
+++ b/groebner/include/polybori/groebner/DelayedLongProduct.h
@@ -18,11 +18,11 @@
// include basic definitions
#include "groebner_defs.h"
-#include "DelayedLongLong.h"
-#include "LongLongConstant.h"
-#include "LongProductLess.h"
+#include "PseudoLongLong.h"
+#include "BitMask.h"
#include "NBitsUsed.h"
+
BEGIN_NAMESPACE_PBORIGB
/** @class DelayedLongProduct
@@ -32,10 +32,14 @@ BEGIN_NAMESPACE_PBORIGB
**/
class DelayedLongProduct:
- private DelayedLongLong {
- typedef DelayedLongLong base;
+ protected std::pair<unsigned long, unsigned long>,
+ protected BitMask<sizeof(unsigned long)*4> {
+
+ typedef std::pair<unsigned long, unsigned long> base;
public:
+ typedef unsigned long long_type;
+
DelayedLongProduct(const long_type& high, const long_type & low):
base(high, low) {}
@@ -49,7 +53,7 @@ public:
/// compare carry-over savely with represented by two unsigned longs
template <long_type MaxHigh, long_type MaxLow>
- bool greater(const LongLongConstant<MaxHigh, MaxLow>&) const {
+ bool greater(const PseudoLongLong<MaxHigh, MaxLow>&) const {
if (second == 0)
return false;
diff --git a/groebner/include/polybori/groebner/Long64From32BitsPair.h b/groebner/include/polybori/groebner/Long64From32BitsPair.h
index a9cd30f..9539908 100644
--- a/groebner/include/polybori/groebner/Long64From32BitsPair.h
+++ b/groebner/include/polybori/groebner/Long64From32BitsPair.h
@@ -18,8 +18,7 @@
// include basic definitions
#include "groebner_defs.h"
-#include "DelayedLongLong.h"
-#include "LongLongConstant.h"
+#include "PseudoLongLong.h"
BEGIN_NAMESPACE_PBORIGB
@@ -28,26 +27,24 @@ BEGIN_NAMESPACE_PBORIGB
*
**/
-template <DelayedLongLong::long_type High,
- DelayedLongLong::long_type Low, unsigned SizeOfLong>
+template <unsigned long High, unsigned long Low, unsigned SizeOfLong>
class Long64From32BitsPairBase;
-template <DelayedLongLong::long_type High,
- DelayedLongLong::long_type Low>
+template <unsigned long High, unsigned long Low>
class Long64From32BitsPairBase<High, Low, 4> {
public:
- static LongLongConstant<High, Low> get() {
- return LongLongConstant<High, Low>();
+ static PseudoLongLong<High, Low> get() {
+ return PseudoLongLong<High, Low>();
}
};
-template <DelayedLongLong::long_type High,
- DelayedLongLong::long_type Low>
+template <unsigned long High,
+ unsigned long Low>
class Long64From32BitsPairBase<High, Low, 8> {
public:
- typedef typename DelayedLongLong::long_type long_type;
+ typedef unsigned long long_type;
static long_type get() { return (High << sizeof(long_type)*4) + Low; }
};
@@ -55,13 +52,12 @@ public:
* @brief This class defines Long64From32BitsPair.
*
**/
-template <DelayedLongLong::long_type High,
- DelayedLongLong::long_type Low>
+template <unsigned long High, unsigned long Low>
class Long64From32BitsPair:
public Long64From32BitsPairBase<High, Low,
- sizeof(DelayedLongLong::long_type)> {
+ sizeof(unsigned long)> {
public:
- typedef typename DelayedLongLong::long_type long_type;
+ typedef unsigned long long_type;
};
diff --git a/groebner/include/polybori/groebner/LongLongConstant.h b/groebner/include/polybori/groebner/LongLongConstant.h
deleted file mode 100644
index 8df2617..0000000
--- a/groebner/include/polybori/groebner/LongLongConstant.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- c++ -*-
-//*****************************************************************************
-/** @file LongLongConstant.h
- *
- * @author Alexander Dreyer
- * @date 2012-02-23
- *
- * This file includes the definition of the class @c LongLongConstant.
- *
- * @par Copyright:
- * (c) 2012
-by The PolyBoRi Team
- *
-**/
-//*****************************************************************************
-
-#ifndef polybori_groebner_LongLongConstant_h_
-#define polybori_groebner_LongLongConstant_h_
-
-// include basic definitions
-#include "groebner_defs.h"
-#include "DelayedLongLong.h"
-
-BEGIN_NAMESPACE_PBORIGB
-
-/** @class LongLongConstant
- * @brief This class defines LongLongConstant.
- *
- **/
-
-template <DelayedLongLong::long_type High,
- DelayedLongLong::long_type Low>
-class LongLongConstant {
-public:
- typedef typename DelayedLongLong::long_type long_type;
- static const long_type first = High;
- static const long_type second = Low;
-
- operator DelayedLongLong() const {
- return DelayedLongLong(first, second);
- }
-#ifdef PBORI_HAVE_LONG_LONG
- operator unsigned long long() const {
- return operator DelayedLongLong();
- }
-#endif
-};
-
-END_NAMESPACE_PBORIGB
-
-#endif /* polybori_groebner_LongLongConstant_h_ */
diff --git a/groebner/include/polybori/groebner/LongProductLess.h b/groebner/include/polybori/groebner/LongProductLess.h
deleted file mode 100644
index bfc392e..0000000
--- a/groebner/include/polybori/groebner/LongProductLess.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- c++ -*-
-//*****************************************************************************
-/** @file LongProductLess.h
- *
- * @author Alexander Dreyer
- * @date 2012-02-23
- *
- * This file includes the definition of the class @c LongProductLess.
- *
- * @par Copyright:
- * (c) 2012 by The PolyBoRi Team
- *
-**/
-//*****************************************************************************
-
-#ifndef polybori_groebner_LongProductLess_h_
-#define polybori_groebner_LongProductLess_h_
-
-// include basic definitions
-#include "groebner_defs.h"
-#include "DelayedLongLong.h"
-
-BEGIN_NAMESPACE_PBORIGB
-
-/** @class LongProductLess
- * @brief This class compared a delayed product with a delayed (constant) sum
- * of (unsigned) long. It avoids to use long long instances.
- *
- **/
-
-template <DelayedLongLong::long_type MaxHigh,
- DelayedLongLong::long_type MaxLow>
-class LongProductLess:
- private DelayedLongLong {
- typedef DelayedLongLong base;
-
-public:
- LongProductLess():
- base(0, 0) {}
-
- bool operator()(const long_type& higher, const long_type & lower) {
-
- return most(high(higher) * high(lower)) ||
- mid(high(higher)*low(lower)) || mid(low(higher)*high(lower)) ||
- least(low(higher)*low(lower));
- }
-
-protected:
- bool most(const long_type& number) {
- first = number;
- second = 0;
- return (first > MaxHigh);
- }
-
- bool mid(const long_type& number) {
- first += high(number);
-
- if (first > MaxHigh)
- return true;
- second += low(number);
-
- first += high(second);
-
- if (first > MaxHigh)
- return true;
-
- second = low(second);
- return false;
- }
-
- bool least(const long_type& number) {
- return mid(high(number)) ||
- ((first == MaxHigh) && ( (shift(second) + low(number)) > MaxLow));
- }
-
-
-};
-
-END_NAMESPACE_PBORIGB
-
-#endif /* polybori_groebner_LongProductLess_h_ */
diff --git a/groebner/include/polybori/groebner/PseudoLongLong.h b/groebner/include/polybori/groebner/PseudoLongLong.h
new file mode 100644
index 0000000..4211b55
--- /dev/null
+++ b/groebner/include/polybori/groebner/PseudoLongLong.h
@@ -0,0 +1,39 @@
+// -*- c++ -*-
+//*****************************************************************************
+/** @file PseudoLongLong.h
+ *
+ * @author Alexander Dreyer
+ * @date 2012-02-23
+ *
+ * This file includes the definition of the class @c PseudoLongLong.
+ *
+ * @par Copyright:
+ * (c) 2012
+by The PolyBoRi Team
+ *
+**/
+//*****************************************************************************
+
+#ifndef polybori_groebner_PseudoLongLong_h_
+#define polybori_groebner_PseudoLongLong_h_
+
+// include basic definitions
+#include "groebner_defs.h"
+
+BEGIN_NAMESPACE_PBORIGB
+
+/** @class PseudoLongLong
+ * @brief This class defines PseudoLongLong.
+ *
+ **/
+
+template <unsigned long High, unsigned long Low>
+class PseudoLongLong {
+public:
+ typedef unsigned long long_type;
+ enum { first = High, second = Low};
+};
+
+END_NAMESPACE_PBORIGB
+
+#endif /* polybori_groebner_PseudoLongLong_h_ */
diff --git a/testsuite/src/DelayedLongProductTest.cc b/testsuite/src/DelayedLongProductTest.cc
index d69bb1d..3800134 100644
--- a/testsuite/src/DelayedLongProductTest.cc
+++ b/testsuite/src/DelayedLongProductTest.cc
@@ -19,7 +19,8 @@
using boost::test_tools::output_test_stream;
#include <polybori/groebner/DelayedLongProduct.h>
-#include <polybori/groebner/LongLongConstant.h>
+#include <polybori/groebner/PseudoLongLong.h>
+#include <polybori/groebner/Long64From32BitsPair.h>
USING_NAMESPACE_PBORI
USING_NAMESPACE_PBORIGB
@@ -43,28 +44,28 @@ BOOST_AUTO_TEST_CASE(test_less) {
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(-1),
(unsigned long)(-1)) >
- LongLongConstant<(unsigned long)(-1), (unsigned long)(-1)>()), true);
+ PseudoLongLong<(unsigned long)(-1), (unsigned long)(-1)>()), true);
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(-1),
(unsigned long)(-1)) >
- LongLongConstant<(unsigned long)(-1), 0>()), false);
+ PseudoLongLong<(unsigned long)(-1), 0>()), false);
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(-1),
(unsigned long)(-1)) >
- LongLongConstant<(unsigned long)(-1)/2,
+ PseudoLongLong<(unsigned long)(-1)/2,
(unsigned long)(-1)>()), true);
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(2)<< nhalf,
(unsigned long)(2)<< nhalf) >
- LongLongConstant<3,(unsigned long)(-1)>()), true);
+ PseudoLongLong<3,(unsigned long)(-1)>()), true);
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(2)<< nhalf ,
(unsigned long)(2)<< nhalf ) >
- LongLongConstant<4,0>()), false);
+ PseudoLongLong<4,0>()), false);
BOOST_CHECK_EQUAL((DelayedLongProduct((unsigned long)(2)<< nhalf,
(unsigned long)(2)<< nhalf )>
- LongLongConstant<4,1>()), false);
+ PseudoLongLong<4,1>()), false);
BOOST_CHECK_EQUAL((DelayedLongProduct(5, 7) > 34), true);
BOOST_CHECK_EQUAL((DelayedLongProduct(5, 7) > 35), false);
@@ -84,6 +85,11 @@ BOOST_AUTO_TEST_CASE(test_less) {
BOOST_CHECK_EQUAL((DelayedLongProduct(5, long_type(7)<<32) >
long_type(36)<<32), false);
+ BOOST_CHECK_EQUAL((DelayedLongProduct(5, long_type(7)<<32) >
+ long_type(36)<<32), false);
+
+
+
}
BOOST_AUTO_TEST_SUITE_END()
--
polybori: Polynomials over Boolean Rings
More information about the debian-science-commits
mailing list