Skip to content

Instantly share code, notes, and snippets.

@fenrig
Last active August 29, 2015 14:17
Show Gist options
  • Save fenrig/40c8d383572d208d4cb2 to your computer and use it in GitHub Desktop.
Save fenrig/40c8d383572d208d4cb2 to your computer and use it in GitHub Desktop.
__kernel void parse_bin(__const unsigned int stap_teller, __const unsigned int num_bins, __global int *result){
unsigned int teller = 0;
unsigned int work_index = (unsigned int) get_global_id(0);
unsigned int index = (work_index << stap_teller) * num_bins;
unsigned int indexwith = index + (stap_teller * num_bins);
for(teller = 0; teller < num_bins; teller++, index++, indexwith++){
result[index] = result[index] + result[indexwith];
result[indexwith] = (int) stap_teller;
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment