cl-compiler / samples /arithmetic.cl
GitHub Actions
Sync from GitHub: fe8c57c
e3486fe
Raw
History Blame Contribute Delete
287 Bytes
// arithmetic.cl — Tests arithmetic expressions and operator precedence
int a;
int b;
int c;
int result;
a = 10;
b = 3;
c = 2;
// result = (a + b) * c - 1 → (10 + 3) * 2 - 1 = 25
result = (a + b) * c - 1;
// Test subtraction and multiplication separately
a = a - b;
b = b * c;