You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there are 2 bad aliasing in the ImfFloatToHalf (float f, ImfHalf *h) function, making compilers and analyzers cry as it does not follow the aliasing rules... easily fixed with a memcpy:
short half = FloatToHalf( (int)&f );
is replaced by
int x;
memcpy((void *)&x,(const void *)&f,sizeof(float));
short half = FloatToHalf(x);
(same for ImfHalf cast).
Assembly generated is exactly the same (on my machine) but compiler is happy and code is now safe if aggressive optimization is turn on.
Cheers,
The text was updated successfully, but these errors were encountered:
there are 2 bad aliasing in the ImfFloatToHalf (float f, ImfHalf *h) function, making compilers and analyzers cry as it does not follow the aliasing rules... easily fixed with a memcpy:
short half = FloatToHalf( (int)&f );
is replaced by
int x;
memcpy((void *)&x,(const void *)&f,sizeof(float));
short half = FloatToHalf(x);
(same for ImfHalf cast).
Assembly generated is exactly the same (on my machine) but compiler is happy and code is now safe if aggressive optimization is turn on.
Cheers,
The text was updated successfully, but these errors were encountered: