Short-circuit evaluation of ? : operator for varying tests.
? : now short-circuits evaluation of the expressions following the boolean test for varying test types. (It already did this for uniform tests). Issue #169.
This commit is contained in:
30
tests/foreach-double-1.ispc
Normal file
30
tests/foreach-double-1.ispc
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
uniform double one = 1;
|
||||
|
||||
void copy(uniform double dst[], uniform double src[], uniform int count) {
|
||||
foreach (i = 0 ... count)
|
||||
dst[i] = one * src[i];
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
uniform int count = 200 + aFOO[1];
|
||||
uniform double * uniform src = uniform new uniform double[count];
|
||||
for (uniform int i = 0; i < count; ++i)
|
||||
src[i] = i;
|
||||
|
||||
uniform double * uniform dst = uniform new uniform double[count];
|
||||
copy(dst, src, count);
|
||||
|
||||
uniform int errors = 0;
|
||||
for (uniform int i = 0; i < count; ++i)
|
||||
if (dst[i] != src[i])
|
||||
++errors;
|
||||
|
||||
RET[programIndex] = errors;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user