[Mesa-dev] [PATCH 2/2] gallium: don't use enum bitfields in p_video_state.h

Michel Dänzer michel at daenzer.net
Thu Jul 14 06:04:35 PDT 2011


On Mit, 2011-07-13 at 16:28 -0600, Brian Paul wrote: 
> Silences many warnings about "type of bit-field ‘field_select’ is a
> GCC extension".
> ---
>  src/gallium/include/pipe/p_video_state.h |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
> index 5b47b15..1f42ac5 100644
> --- a/src/gallium/include/pipe/p_video_state.h
> +++ b/src/gallium/include/pipe/p_video_state.h
> @@ -49,8 +49,8 @@ struct pipe_motionvector
>  {
>     struct {
>        signed x:16, y:16;
> -      enum pipe_video_field_select field_select:16;
> -      enum pipe_video_mv_weight weight:16;
> +      unsigned field_select:16; /**< enum pipe_video_field_select */
> +      unsigned weight:16;  /**< enum pipe_video_mv_weight  */
>     } top, bottom;
>  };
>  
> @@ -58,8 +58,8 @@ struct pipe_motionvector
>  struct pipe_ycbcr_block
>  {
>     unsigned x:8, y:8;
> -   enum pipe_mpeg12_dct_intra intra:8;
> -   enum pipe_mpeg12_dct_type coding:8;
> +   unsigned intra:8;  /**< enum pipe_mpeg12_dct_intra */
> +   unsigned coding:8; /**< enum pipe_mpeg12_dct_type */
>  };
>  
>  struct pipe_picture_desc

Out of curiosity, what's the benefit of using bitfields here at all, as
opposed to fixed size integer types?

IME bitfields are generally best avoided if possible.


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


More information about the mesa-dev mailing list