[Mesa-dev] [PATCH] gallium/vl: partially revert "Use util_cpu_to_le{16, 32} in many more places."

Matt Turner mattst88 at gmail.com
Thu Mar 26 08:59:13 PDT 2015


On Thu, Mar 26, 2015 at 6:57 AM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> The data in memory is in big endian format and needs to be converted
> into CPU byte order. So the patch actually reversed what needs to be done.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  src/gallium/auxiliary/vl/vl_vlc.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/gallium/auxiliary/vl/vl_vlc.h
> index cad9989..2f90595 100644
> --- a/src/gallium/auxiliary/vl/vl_vlc.h
> +++ b/src/gallium/auxiliary/vl/vl_vlc.h
> @@ -149,7 +149,11 @@ vl_vlc_fillbits(struct vl_vlc *vlc)
>        } else if (bytes_left >= 4) {
>
>           /* enough bytes in buffer, read in a whole dword */
> -         uint64_t value = util_cpu_to_le32(*(const uint32_t*)vlc->data);
> +         uint64_t value = *(const uint32_t*)vlc->data;
> +
> +#ifndef PIPE_ARCH_BIG_ENDIAN

Ahh! It was an if*n*def. Pointing that out would have cut a few
minutes of me scratching my head.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

> +         value = util_bswap32(value);
> +#endif
>
>           vlc->buffer |= value << vlc->invalid_bits;
>           vlc->data += 4;
> --
> 1.9.1
>


More information about the mesa-dev mailing list