diff options
author | Yordan Makariev <ym9412@gmail.com> | 2011-12-03 20:25:57 +0200 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-12-03 15:13:48 -0800 |
commit | 425b45d4b0e69c1e1b095301396af3caa6dcbbf3 (patch) | |
tree | 7bef11bc4ea641c040d5c3118ee2104999c3287e /libavutil/random_seed.c | |
parent | 4a59eca97a2f91e69fd26f5e0e34f264ab68b21e (diff) | |
download | ffmpeg-425b45d4b0e69c1e1b095301396af3caa6dcbbf3.tar.gz |
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>
Diffstat (limited to 'libavutil/random_seed.c')
-rw-r--r-- | libavutil/random_seed.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c index ee71542652..51ca99b26d 100644 --- a/libavutil/random_seed.c +++ b/libavutil/random_seed.c @@ -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; } |