[Intel-gfx] [PATCH v2 4/4] drm/i915: introduce _FIELD() to define register field values

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 17 12:58:18 UTC 2019


Quoting Jani Nikula (2019-01-17 12:14:03)
>  #define _MASK(__high, __low)   ((u32)GENMASK(__high, __low))
>  
> +#define __POWER_OF_2(x)        ((x) && (((x) & ((x) - 1)) == 0))

Fwiw, I'd go with IS_POWER_OF_2(x) /* compile-time constant version of is_power_of_2() */

For constexpr!
-Chris


More information about the Intel-gfx mailing list