 Messages in this thread Date Sat, 21 Sep 2013 23:05:53 -0400 From Theodore Ts'o <> Subject Re: [PATCH,RFC] random: make fast_mix() honor its name
`The following fast_mix function, with the loop unrolling, is about 70%slower than your proposed version, but it's still four times fasterthan the original byte-based fast_mix function.  This is what I'mconsidering using as a compromise.Any comments or objections?     					- Tedstatic void fast_mix(struct fast_pool *f, __u32 input){	__u32		w;	int i;	unsigned	input_rotate = f->rotate;#if 0	for (i = 0; i < 4; i++) {		w = rol32(input[i], input_rotate) ^ f->pool[i] ^			f->pool[(i + 3) & 3];		f->pool[i] = (w >> 3) ^ twist_table[w & 7];		input_rotate = (input_rotate + (i ? 7 : 14)) & 31;	}#else   /* loop unrolled for speed */	w = rol32(input, input_rotate) ^ f->pool ^ f->pool;	f->pool = (w >> 3) ^ twist_table[w & 7];	input_rotate = (input_rotate + 14) & 31;	w = rol32(input, input_rotate) ^ f->pool ^ f->pool;	f->pool = (w >> 3) ^ twist_table[w & 7];	input_rotate = (input_rotate + 7) & 31;	w = rol32(input, input_rotate) ^ f->pool ^ f->pool;	f->pool = (w >> 3) ^ twist_table[w & 7];	input_rotate = (input_rotate + 7) & 31;	w = rol32(input, input_rotate) ^ f->pool ^ f->pool;	f->pool = (w >> 3) ^ twist_table[w & 7];	input_rotate = (input_rotate + 7) & 31;#endif	f->count += 16;	f->rotate = input_rotate;}`   Last update: 2013-09-22 05:21    [W:0.243 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site