Comment on Your code is fast if you're luckyparentComments−misev2moYou could rewrite it to int* ptr = ((v != 0) * lwr) + ((v == 0) * rwr); I doubt it would be faster than the ternary though.
Comments
You could rewrite it to
I doubt it would be faster than the ternary though.