diff options
author | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2010-01-08 01:22:43 +0000 |
---|---|---|
committer | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2010-01-08 01:22:43 +0000 |
commit | a038b4f9875d06be339d3abb33967ec9a89c2f8a (patch) | |
tree | ebd77ccb2702f218207077594916f42491527375 /src/wiring/math.cpp | |
parent | 2addfe8c42c6bcdc0a15c751e2436447b73d03fe (diff) | |
download | librambutan-a038b4f9875d06be339d3abb33967ec9a89c2f8a.tar.gz librambutan-a038b4f9875d06be339d3abb33967ec9a89c2f8a.zip |
changed math.h to wiring_math.h to avoid collision with newlib's math library
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@99 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/wiring/math.cpp')
-rw-r--r-- | src/wiring/math.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/wiring/math.cpp b/src/wiring/math.cpp deleted file mode 100644 index 9be7dc3..0000000 --- a/src/wiring/math.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <stdlib.h> -#include "math.h" - -/* from newlib: - * - * rand returns the next pseudo-random integer in sequence; it is a number - * between 0 and RAND_MAX (inclusive). - * - * srand does not return a result. */ - - -/* The rest copied from WMath.cpp */ -void randomSeed(unsigned int seed) { - if (seed != 0) { - srand(seed); - } -} - -long random(long howbig) { - if (howbig == 0) { - return 0; - } - return rand() % howbig; -} - -long random(long howsmall, long howbig) { - if (howsmall >= howbig) { - return howsmall; - } - long diff = howbig - howsmall; - return random(diff) + howsmall; -} - -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; -} - - |