24 Aug
2013
24 Aug
'13
10:47 a.m.
* Mike Speciner <ms@alum.mit.edu> [Aug 24. 2013 18:39]:
Well you could always do y = x&(1<<31); y |= (y>>1)|(y>>2)|...|(y>>31); // all this just to avoid an if which probably costs nothing
With pipelining an "if" (a conditional branch) can be expensive. There are situations where these tricks can give a notable boost in performance.
[...]
Best, jj