[Mesa-dev] [PATCH 4/8] radeonsi: Use util_cpu_to_le32() instead of bswap32() on big-endian systems

Michel Dänzer michel at daenzer.net
Thu Feb 20 18:11:04 PST 2014


On Don, 2014-02-20 at 10:21 -0800, Tom Stellard wrote:
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 54270cd..9b04e6b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -2335,7 +2335,7 @@ int si_compile_llvm(struct si_context *sctx, struct si_pipe_shader *shader,
>  	ptr = (uint32_t*)sctx->b.ws->buffer_map(shader->bo->cs_buf, sctx->b.rings.gfx.cs, PIPE_TRANSFER_WRITE);
>  	if (0 /*SI_BIG_ENDIAN*/) {
>  		for (i = 0; i < binary.code_size / 4; ++i) {
> -			ptr[i] = util_bswap32(*(uint32_t*)(binary.code + i*4));
> +			ptr[i] = util_cpu_to_le32((*(uint32_t*)(binary.code + i*4)));
>  		}
>  	} else {
>  		memcpy(ptr, binary.code, binary.code_size);

We could get rid of the separate *_ENDIAN paths using util_cpu_to_le*().

Either way, the non-clover patches are

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer



More information about the mesa-dev mailing list