]> www.ginac.de Git - ginac.git/commitdiff
This patch fixes a bug on machines where char is unsigned by default, by
authorJens Vollinga <jensv@nikhef.nl>
Sun, 22 May 2011 14:19:17 +0000 (16:19 +0200)
committerJens Vollinga <jensv@nikhef.nl>
Sun, 22 May 2011 14:19:17 +0000 (16:19 +0200)
extending the type of clifford_max_label to include all 257 possible
return values. Thanks to Martin Guy for the bug report and patch.

ginac/add.cpp
ginac/clifford.cpp
ginac/clifford.h

index 42364c07c54f3f00d6d4a801327b08b5314ea669..eb965b6b77cd839e39b694ac1594232a680bd15d 100644 (file)
@@ -308,7 +308,7 @@ ex add::coeff(const ex & s, int n) const
 {
        std::auto_ptr<epvector> coeffseq(new epvector);
        std::auto_ptr<epvector> coeffseq_cliff(new epvector);
-       char rl = clifford_max_label(s);
+       int rl = clifford_max_label(s);
        bool do_clifford = (rl != -1);
        bool nonscalar = false;
 
index 2d1e40d3c567aa6afb29863e380188f3f9d4bc34..301d40c19640a605842079de30e8281293000918 100644 (file)
@@ -1132,7 +1132,7 @@ ex remove_dirac_ONE(const ex & e, unsigned char rl, unsigned options)
        return e1;
 }
 
-char clifford_max_label(const ex & e, bool ignore_ONE)
+int clifford_max_label(const ex & e, bool ignore_ONE)
 {
        if (is_a<clifford>(e))
                if (ignore_ONE && is_a<diracone>(e.op(0)))
@@ -1140,7 +1140,7 @@ char clifford_max_label(const ex & e, bool ignore_ONE)
                else
                        return ex_to<clifford>(e).get_representation_label();
        else {
-               char rl = -1;
+               int rl = -1;
                for (size_t i=0; i < e.nops(); i++) 
                        rl = (rl > clifford_max_label(e.op(i), ignore_ONE)) ? rl : clifford_max_label(e.op(i), ignore_ONE);
                return rl;
index 57e919e1becc3800df005ca6c862a513ade57857..81e49b017f253c007869fd5e7b84175baa56407c 100644 (file)
@@ -301,7 +301,7 @@ ex remove_dirac_ONE(const ex & e, unsigned char rl = 0, unsigned options = 0);
  *
  *  @param e Expression to be processed
  *  @ignore_ONE defines if clifford_ONE should be ignored in the search*/
-char clifford_max_label(const ex & e, bool ignore_ONE = false);
+int clifford_max_label(const ex & e, bool ignore_ONE = false);
 
 /** Calculation of the norm in the Clifford algebra. */
 ex clifford_norm(const ex & e);