On Wed, 25 Mar 2020 at 21:23, George Spelvin <l...@sdf.org> wrote:
>
> igt_mm_config() calls ilog2() on the (pseudo)random 21-bit number
> s>>12.  Once in 2 million seeds, this is zero and ilog2 summons
> the nasal demons.
>
> There was an attempt to handle this case with a max(), but that's
> too late; ms could already be something bizarre.
>
> Given that the low 12 bits of s and ms are always zero, it's a lot
> simpler just to divide them by 4096, then everything fits into 32
> bits, and we can easily generate a random number 1 <= s <= 0x1fffff.
>
> Signed-off-by: George Spelvin <l...@sdf.org>
> Fixes: 14d1b9a6247c
> Cc: Matthew Auld <matthew.a...@intel.com>
> Cc: Jani Nikula <jani.nik...@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.v...@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Matthew Auld <matthew.a...@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to