[ODE] Why is dVector3 defined as dReal[4] ???

Michal Bacik michal at lonelycatgames.com
Thu Feb 13 03:03:02 2003


> > >     IMHO, it's for the sake of speed.
> > >     Take a look at how the FPU doing math you'll see.
> >
> > Can you explain how's FPU doing math? I've been working with FPU for a
> > while, and I know it loads one float (or double) at a time, not 4
> > (except
> > when you're using SIMD or similar extensions, which ODE doesn't seem to
> > use).
>
> When I asked the very same question as you do (why is "Why is dVector3
> defined as dReal[4]") the reply I got was "because of SIMD alignment".
>
> And even though ODE might not use it now, it may in the future.

Quite a strange reason, mainly when this 'extension' could be easily added
when actual SIMD support was implemented.

I tried to change the array to [3] members, but it starts crashing -
apparently the fourth member of dVector3 is already now used in some
equations (or because the memory got written-to by some init-time stuff?).

- mb