Skip to content

Instantly share code, notes, and snippets.

@hyunsik
Created August 29, 2016 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyunsik/1d14287c33f3b5874d674471c6f4fede to your computer and use it in GitHub Desktop.
Save hyunsik/1d14287c33f3b5874d674471c6f4fede to your computer and use it in GitHub Desktop.
Select primitive in vectorized processing model
int sel_le_long_long_col_col(int vec_num, int [] res_sel_vec,
long [] col1, long [] col2, int [] sel_vec) {
int ret = 0;
if (sel_vec == null) {
for (int i = 0; i < vec_num; i++) {
if (col1[i] < col2[i]) {
res_sel_vec[ret++] = i
}
}
} else {
for (int i = 0; i < vec_num; i++) {
int sel_id = sel_vec[i];
if (col1[sel_id] < col2[sel_id]) {
res_sel_vec[ret++] = sel_id;
}
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment