summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2009-12-08 19:13:48 +0100
committerRoland Scheidegger <[email protected]>2009-12-08 19:17:08 +0100
commitee1720b99dfb5964962f2346406a4e3e88374a68 (patch)
treecb07d1ad5ea1a76b262d15c4a47fff97290242cd /src/mesa
parent72362a5cd41d97b770980c28fe6719c556f12ab7 (diff)
gallium: fix more potential strict aliasing issues
In particular, gcc man page warns that union a_union { int i; double d; }; int f() { double d = 3.0; return ((union a_union *) &d)->i; } "might" not be ok (why not?), even though it doesn't seem to generate any warnings. Hence don't use this and do the extra step to actually use assignment to get the values in/out of the union. This changes parts of 3456f9149b3009fcfce80054759d05883d3c4ee5.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 5e2ae1bb36f..6a5854e9ba5 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -162,12 +162,14 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
*/
for (i = 0; i < texSize; i++) {
for (j = 0; j < texSize; j++) {
+ union util_color uc;
int k = (i * texSize + j);
ubyte r = ctx->PixelMaps.RtoR.Map8[j * rSize / texSize];
ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize];
ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize];
ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize];
- util_pack_color_ub(r, g, b, a, pt->format, (union util_color *)(dest + k));
+ util_pack_color_ub(r, g, b, a, pt->format, &uc);
+ *(dest + k) = uc.ui;
}
}