aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/frac.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/frac.h b/common/frac.h
index 1c2c622a2c..b1e6c518d1 100644
--- a/common/frac.h
+++ b/common/frac.h
@@ -46,6 +46,9 @@ enum {
*/
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; }