1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include "test_static.isph"
task void f_f(uniform float RET[], uniform float aFOO[]) {
#ifndef ISPC_HAS_RAND
RET[programIndex] = 0;
#else
uniform int set[64] = { 0 };
uniform int count = 1024*1024;
for (uniform int i = 0; i < count; ++i) {
uniform int64 r;
while (!rdrand(&r))
;
for (uniform int b = 0; b < 64; ++b)
if (((unsigned int64)r >> b) & 1)
++set[b];
}
RET[programIndex] = 0;
for (uniform int b = 0; b < 64; ++b) {
float r = (double)set[b] / (double)(count);
if (!(r >= .49 && r < .51)) {
++RET[programIndex];
}
}
#endif
}
task void result(uniform float RET[]) {
RET[programIndex] = 0;
}
|