diff options
author | Marti Bolivar <mbolivar@mit.edu> | 2010-12-08 23:39:37 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@mit.edu> | 2010-12-08 23:39:37 -0500 |
commit | b67d281d85bd59a9738a9a43c4db1027f81d9208 (patch) | |
tree | 1940b4743a945160d21eb37c8578fa46e9118d4e /wirish/wirish_math.h | |
parent | b34f826ae1470aaa791bd8ed8dd66ccd4d96d82c (diff) | |
download | librambutan-b67d281d85bd59a9738a9a43c4db1027f81d9208.tar.gz librambutan-b67d281d85bd59a9738a9a43c4db1027f81d9208.zip |
Servo library tested and debugged.
Some additional HardwareTimer methods introduced to make this
convenient; ancillary libmaple/timers.h changes resulted.
Diffstat (limited to 'wirish/wirish_math.h')
-rw-r--r-- | wirish/wirish_math.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/wirish/wirish_math.h b/wirish/wirish_math.h index 4543c1b..ae73d61 100644 --- a/wirish/wirish_math.h +++ b/wirish/wirish_math.h @@ -32,7 +32,10 @@ void randomSeed(unsigned int); long random(long); long random(long, long); -long map(long, long, long, long, long); +/* 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 |