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:
20
tests/short-circuit-select-3.ispc
Normal file
20
tests/short-circuit-select-3.ispc
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
float crashEven(uniform float a[]) {
|
||||
int offset = 0;
|
||||
return (programIndex & 1) ? a[offset] : a[offset+1000000];
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
float a0 = aFOO[0], a1 = aFOO[1];
|
||||
if (((programIndex & 1) == 1) && (crashEven(aFOO) == 1))
|
||||
RET[programIndex] = 1;
|
||||
else
|
||||
RET[programIndex] = 2;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (programIndex & 1) ? 1 : 2;
|
||||
}
|
||||
Reference in New Issue
Block a user