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:
parent
6f21500ce0
commit
d7fb34f89c
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue