diff options
| author | Marti Bolivar <mbolivar@mit.edu> | 2010-12-15 01:50:56 -0500 |
|---|---|---|
| committer | Marti Bolivar <mbolivar@mit.edu> | 2010-12-15 16:16:31 -0500 |
| commit | 88cb23747ef424d26e6fffc458b5ebfc678e4d9f (patch) | |
| tree | 4c5558060a03d3f1a5f8f0cfffe29736a682b611 /wirish/wirish_math.h | |
| parent | e2a04cb048edc213addcb545376b1409d57bb7aa (diff) | |
Finalized 0.0.9 documentation.
Diffstat (limited to 'wirish/wirish_math.h')
| -rw-r--r-- | wirish/wirish_math.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wirish/wirish_math.h b/wirish/wirish_math.h index 4156722..14614ba 100644 --- a/wirish/wirish_math.h +++ b/wirish/wirish_math.h @@ -79,8 +79,10 @@ long random(long min, long max); * @return the mapped value. */ /* 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; +inline long map(long value, long fromStart, long fromEnd, + long toStart, long toEnd) { + return (value - fromStart) * (toEnd - toStart) / (fromEnd - fromStart) + + toStart; } #define PI 3.1415926535897932384626433832795 |
