I believe it's better to replace this line (and in other places too) by
```__global float * result = (__global float *)(res + res_idx);```
where ```res_idx``` is ```mad24(gidy, res_step, res_offset + (int)sizeof(float) * gidx);```
and the following lines
```
res_step   /= sizeof(float);
res_offset /= sizeof(float);
```
are useless in such case.