Optimize the down scaling of an Sint32.

While reviewing the compiler output for the last commit, noticed the
code still used a division instead of a shift.
This commit is contained in:
Mark de Wever 2012-03-11 13:14:32 +00:00
parent 6f21500ce0
commit d7fb34f89c

View file

@ -209,7 +209,11 @@ struct tscale<Sint32, S, typename boost::enable_if_c<S != 0>::type>
static Sint32
down(Sint32& value)
{
value /= (1 << S);
if(value > 0) {
value >>= S;
} else {
value = -((-value) >> S);
}
return value;
}