csmash (0.6.6-6.6) 02-gcc4.0.patch

Summary

 matrix |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

    
download this patch

Patch contents

From 19dbbbe68ae7864f424991854ff9762d841d8e15 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Sun, 9 May 2010 21:29:33 +0300
Subject: [PATCH] matrix: compile fixed by Bartosz Fenski <fenio@debian.org>
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 matrix |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/matrix b/matrix
index 14178cb..a633a09 100644
--- a/matrix
+++ b/matrix
@@ -42,15 +42,6 @@
 
 /* __BEGIN__BEGIN__ */
 //__NAMESPACE_BEGIN(ese);
-#if (!defined __GNUG__) || (__GNUC__ == 3)
-template<typename T>
-void swap(T& a, T& b)
-{
-    T c = a;
-    a = b;
-    b = c;
-}
-#endif
 
 // matrix_size MUST BE larger than 1
 template<int matrix_size, typename _float_t = float>
@@ -174,9 +165,10 @@ private:
 		    mx = x;
 		}
 	    }
-	    swap(pivot[k], pivot[piv]);
 
 	    int kk = pivot[k];
+            pivot[k] = pivot[piv];
+            pivot[piv] = kk;
 	    float_t t = m[kk][kk];
 	    if (0 == t) {
 		return 0;
@@ -222,9 +214,10 @@ private:
 		    mx = x;
 		}
 	    }
-	    swap(pivot[k], pivot[piv]);
 
 	    int kk = pivot[kk];
+	    pivot[k] = pivot[piv];
+	    pivot[piv] = kk;
 	    double t = a[kk][kk];
 	    if (0 == t) {
 		return 0;
@@ -283,7 +276,8 @@ private:
 	    }
 	    ik = ip[j];
 	    if (j != k) {
-		swap(ip[j], ip[k]);
+		ip[j] = ip[k];
+		ip[k] = ik;
 		det = -det;
 	    }
 	    u = a[ik][k];
-- 
1.7.0