diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-05-02 01:05:21 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-05-02 01:05:21 +0000 |
commit | c3cb1629111e531b7d66d40dba606ec980e544a9 (patch) | |
tree | c41dc47249a9a641f5a4aee0329868a3864bdf2e | |
parent | dfe25182bbc2b256c6016058b2accf37c1683d64 (diff) | |
parent | 699753cd42ad16dd26f48479342a809db4455e77 (diff) | |
download | sonivox-c3cb1629111e531b7d66d40dba606ec980e544a9.tar.gz |
Snap for 6453963 from 699753cd42ad16dd26f48479342a809db4455e77 to rvc-release
Change-Id: I9c5b328f0500e42436bf32675e0d52ecc8b9ea8e
-rw-r--r-- | arm-wt-22k/lib_src/eas_math.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arm-wt-22k/lib_src/eas_math.c b/arm-wt-22k/lib_src/eas_math.c index dc85051..18f27e9 100644 --- a/arm-wt-22k/lib_src/eas_math.c +++ b/arm-wt-22k/lib_src/eas_math.c @@ -33,6 +33,8 @@ /* anything less than this converts to a fraction too small to represent in 32-bits */ #define MIN_CENTS -18000 +/* anything greater than this converts to a fraction too large to represent in 32-bits */ +#define MAX_CENTS 19200 /*---------------------------------------------------------------------------- * EAS_Calculate2toX() @@ -51,6 +53,7 @@ * *---------------------------------------------------------------------------- */ + EAS_I32 EAS_Calculate2toX (EAS_I32 nCents) { EAS_I32 nDents; @@ -62,6 +65,10 @@ EAS_I32 EAS_Calculate2toX (EAS_I32 nCents) if (nCents < MIN_CENTS) return 0; + if (nCents > MAX_CENTS) { + nCents = MAX_CENTS; + } + /* for the time being, convert cents to dents */ nDents = FMUL_15x15(nCents, CENTS_TO_DENTS); |