Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your
I have an array of signed ints, and I would like to divide by 2^n.
I currently use this routine to do it:
int out = in >= 0 ? int >> n : -((int & 0x7FFFFFFF) >> n);
Is there a better way that does not involve a branch?
For more complete information about compiler optimizations, see our Optimization Notice.