[igt-dev] [PATCH 1/2] lib/igt_aux: fix roundup_power_of_two implementation
Kamil Konieczny
kamil.konieczny at linux.intel.com
Fri Oct 27 09:01:50 UTC 2023
Hi Andrzej,
On 2023-10-26 at 17:50:29 +0200, Andrzej Hajda wrote:
> For arguments greater than (1<<31) 64bit value must
> be shifted, otherwise the result is incorrect.
>
> Signed-off-by: Andrzej Hajda <andrzej.hajda at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> lib/igt_aux.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index fb76b031318..4d887045af7 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -329,7 +329,7 @@ void pipewire_pulse_stop_reserve(void);
> 64 - __builtin_clzll(x), \
> 32 - __builtin_clz(x)) : 0)
>
> -#define roundup_power_of_two(x) ((x) != 0 ? 1 << igt_fls((x) - 1) : 0)
> +#define roundup_power_of_two(x) ((x) != 0 ? 1ULL << igt_fls((x) - 1) : 0)
>
> #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
>
>
> --
> 2.34.1
>
More information about the igt-dev
mailing list