diff options
author | Roland Scheidegger <[email protected]> | 2009-12-08 19:13:48 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2009-12-08 19:17:08 +0100 |
commit | ee1720b99dfb5964962f2346406a4e3e88374a68 (patch) | |
tree | cb07d1ad5ea1a76b262d15c4a47fff97290242cd /src/gallium/drivers/svga | |
parent | 72362a5cd41d97b770980c28fe6719c556f12ab7 (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/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_sampler.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 7f530083d6b..78053e755e2 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -101,6 +101,7 @@ svga_create_sampler_state(struct pipe_context *pipe, { struct svga_context *svga = svga_context(pipe); struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state ); + union util_color uc; cso->mipfilter = translate_mip_filter(sampler->min_mip_filter); cso->magfilter = translate_img_filter( sampler->mag_img_filter ); @@ -121,8 +122,8 @@ svga_create_sampler_state(struct pipe_context *pipe, ubyte a = float_to_ubyte(sampler->border_color[3]); util_pack_color_ub( r, g, b, a, - PIPE_FORMAT_B8G8R8A8_UNORM, - (union util_color *)&cso->bordercolor ); + PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + cso->bordercolor = uc.ui; } /* No SVGA3D support for: |