PATCH: bug and strict aliasing fix for dlls/wind3d
Marcus Meissner
marcus at jet.franken.de
Sun Apr 25 13:45:23 CDT 2004
Hi,
Ciao, Marcus
Changelog:
Fixed position of tmp.f assigned like in dlls/d3d8/shader.c
Fixed strict aliasing problem.
Index: dlls/wined3d/vertexshader.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/vertexshader.c,v
retrieving revision 1.2
diff -u -r1.2 vertexshader.c
--- dlls/wined3d/vertexshader.c 1 Mar 2004 21:32:02 -0000 1.2
+++ dlls/wined3d/vertexshader.c 25 Apr 2004 18:44:35 -0000
@@ -116,14 +116,17 @@
}
void vshader_expp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
- float tmp_f = floorf(s0->w);
- DWORD tmp_d = 0;
- tmp_f = powf(2.0f, s0->w);
- tmp_d = *((DWORD*) &tmp_f) & 0xFFFFFF00;
+ union {
+ float f;
+ DWORD d;
+ } tmp;
- d->x = powf(2.0f, tmp_f);
- d->y = s0->w - tmp_f;
- d->z = *((float*) &tmp_d);
+ tmp.f = floorf(s0->w);
+ d->x = powf(2.0f, tmp.f);
+ d->y = s0->w - tmp.f;
+ tmp.f = powf(2.0f, s0->w);
+ tmp.d &= 0xFFFFFF00U;
+ d->z = tmp.f;
d->w = 1.0f;
VSTRACE(("executing exp: s0=(%f, %f, %f, %f) => d=(%f, %f, %f, %f)\n",
s0->x, s0->y, s0->z, s0->w, d->x, d->y, d->z, d->w));
--
More information about the wine-patches
mailing list