AnsweredAssumed Answered

Most efficient way of dividing by power of two

Question asked by boxerab on Jun 16, 2014
Latest reply on Jun 30, 2014 by boxerab

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?

Outcomes