]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/matriz.C
mathed95.diff
[lyx.git] / src / mathed / matriz.C
index 77b60312b8ab2759649b52a5826930d5ae22624a..7394abede2f06d08f9684974217fccf0f56f9d53 100644 (file)
@@ -1,11 +1,23 @@
 #include <config.h>
 
-#include <cstring>
+#include <cstring> // memcpy
 
 #include "matriz.h"
 
-static inline
-int odd(int x) { return ((x) & 1); }
+#ifndef CXX_GLOBAL_CSTD
+using std::memcpy;
+#endif
+namespace {
+
+inline
+int odd(int x)
+{
+       return (x & 1);
+}
+
+} // namespace anon
+
 
 #define mateq(m1, m2)  memcpy(m1, m2, sizeof(matriz_data))
 
@@ -25,8 +37,10 @@ void Matriz::rota(int code)
        mateq(r, MATIDEN);
        float const cs = (odd(code)) ? 0 : (1 - code);
        float const sn = (odd(code)) ? (2 - code) : 0;
-       r[0][0] = cs;         r[0][1] = sn;
-       r[1][0] = -r[0][1];   r[1][1] = r[0][0];
+       r[0][0] = cs;
+       r[0][1] = sn;
+       r[1][0] = -r[0][1];
+       r[1][1] = r[0][0];
        matmat(r);
 }
 
@@ -35,18 +49,19 @@ void Matriz::escala(float x, float y)
 {
        matriz_data s;
        mateq(s, MATIDEN);
-       s[0][0] = x;  s[1][1] = y;
+       s[0][0] = x;
+       s[1][1] = y;
        matmat(s);
 }
 
 
 void Matriz::matmat(matriz_data & a)
 {
-       matriz_data c;   
-       for (int i = 0; i < 2; ++i) {
-               c[0][i] = a[0][0] * m_[0][i] + a[0][1] * m_[1][i];
-               c[1][i] = a[1][0] * m_[0][i] + a[1][1] * m_[1][i];
-       }
+       matriz_data c;
+       c[0][0] = a[0][0] * m_[0][0] + a[0][1] * m_[1][0];
+       c[1][0] = a[1][0] * m_[0][0] + a[1][1] * m_[1][0];
+       c[0][1] = a[0][0] * m_[0][1] + a[0][1] * m_[1][1];
+       c[1][1] = a[1][0] * m_[0][1] + a[1][1] * m_[1][1];
        mateq(m_, c);
 }