diff options
-rw-r--r-- | common/frac.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/frac.h b/common/frac.h index d71d31645b..4e3bcf267f 100644 --- a/common/frac.h +++ b/common/frac.h @@ -46,7 +46,7 @@ typedef int32 frac_t; inline frac_t doubleToFrac(double value) { return (frac_t)(value * FRAC_ONE); } inline double fracToDouble(frac_t value) { return ((double)value) / FRAC_ONE; } -inline frac_t intToFrac(int16 value) { return value << FRAC_BITS; } -inline int16 fracToInt(frac_t value) { return value >> FRAC_BITS; } +inline frac_t intToFrac(int16 value) { return value * (1 << FRAC_BITS); } +inline int16 fracToInt(frac_t value) { return value / (1 << FRAC_BITS); } #endif |