shithub: dumb

Download patch

ref: 78451591f26c2f56692972c438da52ac66e325a1
parent: 86c4bc48273411469e5fb85c352ccf38eb207d18
author: dmitrykos <dmitrykos@neutroncode.com>
date: Thu Dec 14 17:01:01 EST 2017

Reapplied corrections after sync:

Allow NEON resampler for WinRT (when ARM is targeted).
Disallow SSE resampler for X86 if SSE mode is not enabled by the compiler.
Fixed symbol conflict with system log2() (BlackBerry 10, PlayBook platforms were affected).

--- a/src/helpers/resampler.c
+++ b/src/helpers/resampler.c
@@ -12,7 +12,8 @@
 #if TARGET_CPU_ARM || TARGET_CPU_ARM64
 #define RESAMPLER_NEON
 #endif
-#elif (defined(__arm__) && defined(__ARM_NEON__))
+#elif (defined(__arm__) && defined(__ARM_NEON__)) || \
+      (defined(_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_WIN8) && defined(_M_ARM))
 #define RESAMPLER_NEON
 #endif
 #ifdef RESAMPLER_NEON
--- a/src/it/itrender.c
+++ b/src/it/itrender.c
@@ -4380,18 +4380,16 @@
     playing->sample_vibrato_time += playing->sample->vibrato_speed;
 }
 
-#if (defined(_MSC_VER) && _MSC_VER < 1800) || defined(__ANDROID__)
-static float log2(float x) { return (float)log(x) / (float)log(2.0f); }
-#endif
-
 static int delta_to_note(float delta, int base) {
+#define DUMB_LOG2(x) ((float)log((x))/(float)log(2.0f))
     float note;
-    note = log2(delta * 65536.f / (float)base) * 12.0f + 60.5f;
+    note = DUMB_LOG2(delta * 65536.f / (float)base) * 12.0f + 60.5f;
     if (note > 119)
         note = 119;
     else if (note < 0)
         note = 0;
     return (int)note;
+#undef DUMB_LOG2
 }
 
 // Period table for Protracker octaves 0-5: