diff options
author | Marti Bolivar <mbolivar@mit.edu> | 2010-12-14 15:41:17 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@mit.edu> | 2010-12-14 15:41:17 -0500 |
commit | 74c8937446e1be4e0d21f69a8c098e2caf7814d5 (patch) | |
tree | 1c7b8e4d93a9512ee54cdd6c5bb7ede064f96b3e /wirish/wirish_math.h | |
parent | 5ceac644e90c929e77f05d357d1d35d45e673fac (diff) | |
parent | b67d281d85bd59a9738a9a43c4db1027f81d9208 (diff) | |
download | librambutan-74c8937446e1be4e0d21f69a8c098e2caf7814d5.tar.gz librambutan-74c8937446e1be4e0d21f69a8c098e2caf7814d5.zip |
Merge branch 'master' into newdoc
Diffstat (limited to 'wirish/wirish_math.h')
-rw-r--r-- | wirish/wirish_math.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/wirish/wirish_math.h b/wirish/wirish_math.h index 9578eb4..4156722 100644 --- a/wirish/wirish_math.h +++ b/wirish/wirish_math.h @@ -78,9 +78,10 @@ long random(long min, long max); * @param toEnd the end of the value's mapped range. * @return the mapped value. */ -long map(long value, - long fromStart, long fromEnd, - long toStart, long toEnd); +/* TODO: profile code bloat due to inlining this */ +inline long map(long x, long in_min, long in_max, long out_min, long out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} #define PI 3.1415926535897932384626433832795 #define HALF_PI 1.5707963267948966192313216916398 |