illwieckz

vectorize some loop

Jul 19th, 2021 (edited)
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.43 KB | None | 0 0
  1.         d = dists[ i ] / ( dists[ i ] - dists[ i + 1 ] );
  2.  
  3. -       for ( j = 0; j < 3; j++ )
  4. -       {
  5. -           e = v[ j ] + d * ( v[ j + 3 ] - v[ j ] );
  6. -           newv[ 0 ][ newc[ 0 ] ][ j ] = e;
  7. -           newv[ 1 ][ newc[ 1 ] ][ j ] = e;
  8. -       }
  9. +       vec3_t temp;
  10. +       float *nextvec = vec + 3;
  11. +       VectorSubtract( nextvec, vec, temp );
  12. +       VectorMA( vec, d, temp, temp );
  13. +       VectorCopy( temp, newv[ 0 ][ newc[ 0 ] ] );
  14. +       VectorCopy( temp, newv[ 1 ][ newc[ 1 ] ] );
Add Comment
Please, Sign In to add comment