• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#pragma version(1)
2#pragma rs java_package_name(android.renderscript.cts)
3
4#include "shared.rsh"
5
6int memset_toValue = 0;
7
8int compare_value = 0;
9int compare_failure = 2;
10
11// 0 = +, 1 = -, 2 = *, 3 = /
12int arith_operation = 0;
13int arith_use_rs_allocation = 0;
14rs_allocation arith_rs_input;
15int arith_value = 0;
16
17void arith(const int *ain, int *aout, uint32_t x) {
18    int value = arith_value;
19
20    if (arith_use_rs_allocation)
21        value = *(int*)(rsGetElementAt(arith_rs_input, x));
22
23    if (arith_operation == 0) {
24        *aout = *ain + value;
25    } else if (arith_operation == 1) {
26        *aout = *ain - value;
27    } else if (arith_operation == 2) {
28        *aout = *ain * value;
29    } else if (arith_operation == 3) {
30        *aout = *ain / value;
31    }
32
33}
34
35void memset(int *aout) {
36    *aout = memset_toValue;
37    return;
38}
39
40void compare(const int *ain) {
41    if (*ain != compare_value) {
42        rsAtomicCas(&compare_failure, 2, -1);
43    }
44    return;
45}
46
47void getCompareResult(int* aout) {
48    *aout = compare_failure;
49}
50