mirror of https://github.com/PCSX2/pcsx2.git
FixedInt - round instead of truncate on construction
This could have caused issues where e.g. Fixed100(59.94) differed from Fixed100::fromString("59.94") due to precision compilation flags (the former could, and did on Devel builds, end up with Raw == 5993, which differs from the value constructed from the string at the ini file, and then it would be incorrectly identified as a custom rate). Rounding seems the more likely intention when effectively decreasing the precision of a value. Unlikely that we have code which depends on truncating behavior, though not impossible.
This commit is contained in:
parent
2d97f6dd53
commit
d10bbb73f7
|
@ -33,13 +33,13 @@ FixedInt<Precision>::FixedInt( int signedval )
|
|||
template< int Precision >
|
||||
FixedInt<Precision>::FixedInt( double doubval )
|
||||
{
|
||||
Raw = (int)(doubval * (double)Precision);
|
||||
Raw = lround(doubval * (double)Precision);
|
||||
}
|
||||
|
||||
template< int Precision >
|
||||
FixedInt<Precision>::FixedInt( float floval )
|
||||
{
|
||||
Raw = (int)(floval * (float)Precision);
|
||||
Raw = lroundf(floval * (float)Precision);
|
||||
}
|
||||
|
||||
template< int Precision >
|
||||
|
|
Loading…
Reference in New Issue