From 5d419c2b58841b2bc56c40caebab5e38622dee88 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 11 Sep 2017 21:38:58 +0100 Subject: AUDIO: Rename two functions in ModuleModXmS3m This is an attempt to fix a compilation error on some platforms. The error message seems to indicate that log2 might be a define on thos platforms. Note that the log2 implementation in ModuleModXmS3m is not the binary logarithm, and we cannot use Common::intLog2. --- audio/mods/mod_xm_s3m.cpp | 6 +++--- audio/mods/module_mod_xm_s3m.cpp | 10 +++++----- audio/mods/module_mod_xm_s3m.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'audio') diff --git a/audio/mods/mod_xm_s3m.cpp b/audio/mods/mod_xm_s3m.cpp index fdacbbbadc..615e587380 100644 --- a/audio/mods/mod_xm_s3m.cpp +++ b/audio/mods/mod_xm_s3m.cpp @@ -665,7 +665,7 @@ void ModXmS3mStream::trigger(Channel &channel) { if (_module.linearPeriods) { channel.portaPeriod = 7744 - period; } else { - channel.portaPeriod = 29021 * ModuleModXmS3m::exp2((period << FP_SHIFT) / -768) >> FP_SHIFT; + channel.portaPeriod = 29021 * ModuleModXmS3m::moduleExp2((period << FP_SHIFT) / -768) >> FP_SHIFT; } if (!porta) { channel.period = channel.portaPeriod; @@ -720,12 +720,12 @@ void ModXmS3mStream::calculateFreq(Channel &channel) { if (per < 28 || per > 7680) { per = 7680; } - channel.freq = ((_module.c2Rate >> 4) * ModuleModXmS3m::exp2(((4608 - per) << FP_SHIFT) / 768)) >> (FP_SHIFT - 4); + channel.freq = ((_module.c2Rate >> 4) * ModuleModXmS3m::moduleExp2(((4608 - per) << FP_SHIFT) / 768)) >> (FP_SHIFT - 4); } else { if (per > 29021) { per = 29021; } - per = (per << FP_SHIFT) / ModuleModXmS3m::exp2((channel.arpeggioAdd << FP_SHIFT) / 12); + per = (per << FP_SHIFT) / ModuleModXmS3m::moduleExp2((channel.arpeggioAdd << FP_SHIFT) / 12); if (per < 28) { per = 29021; } diff --git a/audio/mods/module_mod_xm_s3m.cpp b/audio/mods/module_mod_xm_s3m.cpp index 6283dbe726..3ea68e5486 100644 --- a/audio/mods/module_mod_xm_s3m.cpp +++ b/audio/mods/module_mod_xm_s3m.cpp @@ -94,7 +94,7 @@ const int ModuleModXmS3m::exp2table[] = { 65536 }; -int ModuleModXmS3m::exp2(int x) { +int ModuleModXmS3m::moduleExp2(int x) { int c, m, y; int x0 = (x & FP_MASK) >> (FP_SHIFT - 7); c = exp2table[x0]; @@ -103,10 +103,10 @@ int ModuleModXmS3m::exp2(int x) { return (y << FP_SHIFT) >> (FP_SHIFT - (x >> FP_SHIFT)); } -int ModuleModXmS3m::log2(int x) { +int ModuleModXmS3m::moduleLog2(int x) { int y = 16 << FP_SHIFT; for (int step = y; step > 0; step >>= 1) { - if (exp2(y - step) >= x) { + if (moduleExp2(y - step) >= x) { y -= step; } } @@ -337,7 +337,7 @@ bool ModuleModXmS3m::loadMod(Common::SeekableReadStream &st) { uint period = (first & 0xF) << 8; period = (period | second) * 4; if (period >= 112 && period <= 6848) { - int key = -12 * log2((period << FP_SHIFT) / 29021); + int key = -12 * moduleLog2((period << FP_SHIFT) / 29021); key = (key + (key & (FP_ONE >> 1))) >> FP_SHIFT; patterns[i].notes[idx].key = key; } @@ -688,7 +688,7 @@ bool ModuleModXmS3m::loadS3m(Common::SeekableReadStream &st) { sample.loopLength = loopLength; bool sixteenBit = samParam & 0x4; - int tune = (log2(st.readUint32LE()) - log2(c2Rate)) * 12; + int tune = (moduleLog2(st.readUint32LE()) - moduleLog2(c2Rate)) * 12; sample.relNote = tune >> FP_SHIFT; sample.finetune = (tune & FP_MASK) >> (FP_SHIFT - 7); st.skip(12); // skip unused bytes diff --git a/audio/mods/module_mod_xm_s3m.h b/audio/mods/module_mod_xm_s3m.h index d92ac6679c..b4c984ad05 100644 --- a/audio/mods/module_mod_xm_s3m.h +++ b/audio/mods/module_mod_xm_s3m.h @@ -155,8 +155,8 @@ public: bool load(Common::SeekableReadStream &stream); // math functions - static int log2(int x); - static int exp2(int x); + static int moduleLog2(int x); + static int moduleExp2(int x); private: bool loadMod(Common::SeekableReadStream &stream); -- cgit v1.2.3