I did some tests with the C compiler of Visual Studio 2008, the two methods of dot below made no difference in the generated assembly code:

 

 

typedef struct Vec {
    float x, y, z;
} Vec;

#define DOT(a, b) (a.x*b.x + a.y*b.y + a.z*b.z)

__forceinline float dot(const Vec *a, const Vec *b)
{
    return (a->x*b->x + a->y*b->y + a->z*b->z);

 

相关文章:

  • 2022-03-08
  • 2022-12-23
  • 2021-10-18
  • 2021-06-04
  • 2022-12-23
  • 2021-08-23
  • 2021-11-21
  • 2021-07-09
猜你喜欢
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-07-01
  • 2021-12-05
相关资源
相似解决方案