File: switch_case.cl

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (19 lines) | stat: -rw-r--r-- 393 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
__kernel void
test_kernel (global int *output)
{
  size_t flat_id = get_global_id (2) * get_global_size (1)
                   + get_global_id (1) * get_global_size (0)
                   + get_global_id (0);

  switch (flat_id)
    {
    case 1:
      output[flat_id] = 101;
      return;
    case 3:
      output[flat_id] = 303;
      break;
    default:
      output[flat_id] = 99;
    }
}