sconv: Fix generation of floats in SSE test code
authorPeter Meerwald <p.meerwald@bct-electronic.com>
Mon, 9 Jan 2012 12:51:27 +0000 (13:51 +0100)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Wed, 11 Jan 2012 16:41:24 +0000 (22:11 +0530)
the random floats x should be zero-mean with -(1+eps)<x<(1+eps) for some
small epsilon; previously only negative x were generated

src/pulsecore/sconv_sse.c

index 22aaf6c..3c9a809 100644 (file)
@@ -182,7 +182,7 @@ static void run_test(void) {
     memset(samples, 0, sizeof(samples));
 
     for (i = 0; i < SAMPLES; i++) {
-        floats[i] = (rand()/(RAND_MAX+2.2)) - 1.1;
+        floats[i] = 2.1f * (rand()/(float) RAND_MAX - 0.5f);
     }
 
     func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE);