This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recent troubles with float vectors & bitwise ops


On 8/22/07, Dave Korn <dave.korn@artimi.com> wrote:
> float InvSqrt (float x){
>     float xhalf = 0.5f*x;
>     int i = *(int*)&x;

You are violating C/C++ aliasing rules here anyways.

>     i = 0x5f3759df - (i>>1);
>     x = *(float*)&i;

Likewise.

So I guess you like to depend on undefined code :).

-- Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]