Skip to content

Instantly share code, notes, and snippets.

@antonshkurenko
Created October 22, 2015 20:14
Show Gist options
  • Select an option

  • Save antonshkurenko/635a99250463396e6281 to your computer and use it in GitHub Desktop.

Select an option

Save antonshkurenko/635a99250463396e6281 to your computer and use it in GitHub Desktop.
int a = in0[i], b = in1[i];
int cmp = a < b; //if TRUE, cmp has all bits 1, if FALSE all bits 0
// & bitwise AND
// | bitwise OR
// ~ flips all bits
out[i] = (a&cmp) | (b&~cmp); //a when TRUE and b when FALSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment