Re: [PATCH RFC] random: Account for entropy loss due to overwrites

From: H. Peter Anvin
Date: Tue Oct 16 2012 - 12:10:59 EST


On 10/16/2012 08:53 AM, Theodore Ts'o wrote:
>
> ... and it looks like include/linux/log2.h already has a definition
> for ilog2() which should definitely work for all versions of gcc, so
> we could do this instead:
>
> #define shiftbits(w) (ilog2((w)) + 5)
>
> /* x^128 + x^103 + x^76 + x^51 +x^25 + x + 1 -- 105 */
> { shiftbits(128), 103, 76, 51, 25, 1 },
> /* x^32 + x^26 + x^20 + x^14 + x^7 + x + 1 -- 15 */
> { shiftbits(32), 26, 20, 14, 7, 1 },
>

OK, works for me. I'll rev the patch later this week.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/