summaryrefslogtreecommitdiff
path: root/src/solvers/check.cl
blob: 0ad187a236cef32ec3779dfc90eb4983e961facc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma OPENCL EXTENSION cl_intel_printf : enable
__kernel void check(__global unsigned long* permutations, __global int* results, 
        unsigned long* instructions, unsigned int n, unsigned int w, unsigned long offset) {
            int id = get_global_id(0);
            unsigned long curr_mask = mask | permutations[id + offset];

            unsigned long tmask, sum, stones;
              stones = tmask = sum = 0;
              for (int i = 1; i <= w + 1; i++) {
                  if ((curr_mask & (1 << i)) == 0) {
                      stones += 1;
                      tmask |= 1 << (i - sum);
                      sum = i;
                  }
              }
              if (tmask == (1 << (n + 1)) - 2 && stones == n) {
                    printf("test");
                    results[id] = id;
              }
}