PageRenderTime 12ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/ode/ode_source/ode/src/fastdot.c

http://narutortsproject.googlecode.com/
C | 30 lines | 26 code | 3 blank | 1 comment | 2 complexity | 4271ee06699c2f5bd09d6c6aba08ba5c MD5 | raw file
 1/* generated code, do not edit. */
 2
 3#include "ode/matrix.h"
 4
 5
 6dReal dDot (const dReal *a, const dReal *b, int n)
 7{  
 8  dReal p0,q0,m0,p1,q1,m1,sum;
 9  sum = 0;
10  n -= 2;
11  while (n >= 0) {
12    p0 = a[0]; q0 = b[0];
13    m0 = p0 * q0;
14    p1 = a[1]; q1 = b[1];
15    m1 = p1 * q1;
16    sum += m0;
17    sum += m1;
18    a += 2;
19    b += 2;
20    n -= 2;
21  }
22  n += 2;
23  while (n > 0) {
24    sum += (*a) * (*b);
25    a++;
26    b++;
27    n--;
28  }
29  return sum;
30}