Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Yordan Makariev
2011-12-03 20:25:57 +02:00
committed by Ronald S. Bultje
parent 4a59eca97a
commit 425b45d4b0
6 changed files with 284 additions and 233 deletions

View File

@@ -40,24 +40,24 @@ static int read_random(uint32_t *dst, const char *file)
static uint32_t get_generic_seed(void)
{
clock_t last_t=0;
int bits=0;
uint64_t random=0;
clock_t last_t = 0;
int bits = 0;
uint64_t random = 0;
unsigned i;
float s=0.000000000001;
float s = 0.000000000001;
for(i=0;bits<64;i++){
clock_t t= clock();
if(last_t && fabs(t-last_t)>s || t==(clock_t)-1){
if(i<10000 && s<(1<<24)){
s+=s;
i=t=0;
}else{
random= 2*random + (i&1);
for (i = 0; bits < 64; i++) {
clock_t t = clock();
if (last_t && fabs(t - last_t) > s || t == (clock_t) -1) {
if (i < 10000 && s < (1 << 24)) {
s += s;
i = t = 0;
} else {
random = 2 * random + (i & 1);
bits++;
}
}
last_t= t;
last_t = t;
}
#ifdef AV_READ_TIME
random ^= AV_READ_TIME();
@@ -65,7 +65,7 @@ static uint32_t get_generic_seed(void)
random ^= clock();
#endif
random += random>>32;
random += random >> 32;
return random;
}