[GEM-cvs] Gem/src/Particles part_vector.h,1.3,1.4 partlib_actions.cpp,1.7,1.8 partlib_vector.h,1.3,1
Brought to you by:
zmoelnig
From: Jamie T. <ti...@us...> - 2004-12-22 17:44:58
|
Update of /cvsroot/pd-gem/Gem/src/Particles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19522 Modified Files: part_vector.h partlib_actions.cpp partlib_vector.h Log Message: ppc only: sqrt speed up via assembly instruction (at least 2x) - header consolidation: #includes should go in headers! Index: partlib_vector.h =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Particles/partlib_vector.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** partlib_vector.h 24 Sep 2003 04:33:43 -0000 1.3 --- partlib_vector.h 22 Dec 2004 17:44:40 -0000 1.4 *************** *** 19,22 **** --- 19,33 ---- #endif + #ifdef __ppc__ + #include "ppc_intrinsics.h" + #undef sqrtf + #define sqrtf fast_sqrtf + inline float fast_sqrtf(float x) + { + register float est = (float)__frsqrte(x); + return x * 0.5f * est * __fnmsubs(est * est, x, 3.0f); + } + #endif + #ifdef WIN32 #define drand48() (((float) rand())/((float) RAND_MAX)) Index: partlib_actions.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Particles/partlib_actions.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** partlib_actions.cpp 21 Oct 2003 14:44:00 -0000 1.7 --- partlib_actions.cpp 22 Dec 2004 17:44:40 -0000 1.8 *************** *** 855,859 **** // Compute force exerted between the two bodies pVector acc(tohim * (magdt / (sqrtf(tohimlenSqr) * (tohimlenSqr + epsilon)))); - m.vel += acc; mj.vel -= acc; --- 855,858 ---- Index: part_vector.h =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Particles/part_vector.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** part_vector.h 14 Sep 2003 20:47:02 -0000 1.3 --- part_vector.h 22 Dec 2004 17:44:40 -0000 1.4 *************** *** 9,16 **** #define particle_vector_h - #ifndef __APPLE__ #include <math.h> ! #else ! #include </usr/include/math.h> #endif --- 9,19 ---- #define particle_vector_h #include <math.h> ! ! #ifdef __ppc__ ! #include "Base/GemFuncUtil.h" ! #undef sqrt ! #define sqrt fast_sqrtf ! #define sqrtf fast_sqrtf #endif |