[SCM] polybori: Polynomials over Boolean Rings branch, upstream-hg, updated. b4a5cffaa908c53e1d958a42110f8c4dad853aa3

Alexander Dreyer adreyer at gmx.de
Fri Mar 23 08:01:16 UTC 2012


The following commit has been merged in the upstream-hg branch:
commit cc57c74245792e1f12d0cfbfe651dd7c05319df7
Author: Alexander Dreyer <adreyer at gmx.de>
Date:   Tue Feb 21 17:17:35 2012 +0100

    FIX: checking for long long in C++ 98

diff --git a/SConstruct b/SConstruct
index dc2d99d..b8d1108 100644
--- a/SConstruct
+++ b/SConstruct
@@ -587,6 +587,19 @@ if not env.GetOption('clean'):
         context.Result(result)
         return result
 
+    def CheckLongLong(context):
+        context.Message('Checking whether C++ knows about long long... ')
+        test_src_longlong =  """
+        int main(int argc, char **argv) {
+          long long val = 0LL;
+          return (int)val;
+        }
+        """
+        (result, values) = context.TryRun(test_src_longlong, '.cc')
+        result = (result == 1)
+        context.Result(result)
+        return result
+
     def GuessM4RIFlags(context, external):
         context.Message('Guessing m4ri compile flags... ')
         if not external:
@@ -630,12 +643,16 @@ if not env.GetOption('clean'):
 
     conf = Configure(env, 
                      custom_tests = {'CheckSizeOfTypes': CheckSizeOfTypes,
+                                     'CheckLongLong': CheckLongLong,
                                      'GuessM4RIFlags': GuessM4RIFlags})
+
     if not conf.CheckSizeOfTypes():
         print "Could not detect type sizes (maybe compile/link flags " + \
             "trouble)! Exiting."
         Exit(1)
 
+    if conf.CheckLongLong():
+        env.Append(CPPDefines='PBORI_HAVE_LONG_LONG')
 
     gdlibs = env["GD_LIBS"]
     if gdlibs and conf.CheckCHeader("gd.h"):
diff --git a/groebner/include/polybori/groebner/groebner_defs.h b/groebner/include/polybori/groebner/groebner_defs.h
index ae23eec..8546330 100644
--- a/groebner/include/polybori/groebner/groebner_defs.h
+++ b/groebner/include/polybori/groebner/groebner_defs.h
@@ -32,13 +32,16 @@ typedef polybori::BooleMonomial Monomial;
 typedef polybori::BooleVariable Variable;
 typedef polybori::BooleExponent Exponent;
 typedef std::vector<Polynomial> PolynomialVector;
-/*typedef boost::int_fast_t<64> wlen_type;
-typedef boost::int_fast_t<32> len_type;
-typedef boost::int_fast_t<16> deg_type;*/
+
+#ifdef PBORI_HAVE_LONG_LONG
 typedef long long wlen_type;
+#else
+typedef long wlen_type;
+#endif
 typedef long len_type;
 typedef int deg_type;
-typedef  polybori::CTypes::idx_type idx_type;
+
+typedef polybori::CTypes::idx_type idx_type;
 typedef polybori::BooleSet MonomialSet;
 END_NAMESPACE_PBORIGB
 
diff --git a/groebner/include/polybori/groebner/linear_algebra_step.h b/groebner/include/polybori/groebner/linear_algebra_step.h
index 3e2e99d..27ec0cb 100644
--- a/groebner/include/polybori/groebner/linear_algebra_step.h
+++ b/groebner/include/polybori/groebner/linear_algebra_step.h
@@ -260,10 +260,11 @@ linalg_step_modified(std::vector < Polynomial > &polys, MonomialSet terms, Monom
     int unmodified_rows=polys.size();
     int unmodified_cols=terms.size();
 
-    if PBORI_UNLIKELY(((long long) unmodified_cols)*((long long) unmodified_rows)>20000000000ll){
+    if PBORI_UNLIKELY(((wlen_type) unmodified_cols)*((wlen_type) unmodified_rows)>20000000000ll){
       PBoRiError error(CTypes::matrix_size_exceeded);
       throw error;
     }
+
     static int round=0;
     round++;
     // const int russian_k=16; ///

-- 
polybori: Polynomials over Boolean Rings



More information about the debian-science-commits mailing list