diff options
author | David Fioramonti | 2018-08-16 16:47:28 -0700 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:51:40 +0200 |
commit | 51c11efbbc5a85853fe8bdedd2012f7080b893d6 (patch) | |
tree | 79c2f82339b515e028e48397f9c08518e66590ad /common/sinetables.h | |
parent | cf99bb0a5e4ff796dbede334e66cad4a0682baf4 (diff) | |
download | scummvm-rg350-51c11efbbc5a85853fe8bdedd2012f7080b893d6.tar.gz scummvm-rg350-51c11efbbc5a85853fe8bdedd2012f7080b893d6.tar.bz2 scummvm-rg350-51c11efbbc5a85853fe8bdedd2012f7080b893d6.zip |
COMMON: Cos/Sin Table switch internal structure so at() is faster
A new internal table has been added so that no if checks need to
be performed for the at() lookup.
The old table can still be accessed using getTable or atLegacy().
at() and atLegacy() return the same values, but at() is faster.
Diffstat (limited to 'common/sinetables.h')
-rw-r--r-- | common/sinetables.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/common/sinetables.h b/common/sinetables.h index 5a5f246467..bd030ca833 100644 --- a/common/sinetables.h +++ b/common/sinetables.h @@ -46,15 +46,23 @@ public: * - Entries 2_nPoints/4 up to nPoints/2: * sin(pi) till (excluding) sin(3/2*pi) */ - const float *getTable() { return _table; } + const float *getTable() { return _tableEOS; } /** * Returns sin(2*pi * index / nPoints ) * Index must be in range [0, nPoints - 1] + * Faster than atLegacy */ float at(int index) const; + /** + * Returns sin(2*pi * index / nPoints ) + * Index must be in range [0, nPoints - 1] + */ + float atLegacy(int index) const; + private: + float *_tableEOS; float *_table; double _radResolution; // Smallest radian increment int _refSize; // _nPoints / 4 |