Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Delgado <jdelgado@gmx.net>2020-12-25 17:52:05 +0300
committerJan Delgado <jdelgado@gmx.net>2020-12-25 18:27:12 +0300
commit918943b46e9e93a848725c44fe6f6cfc6a60c798 (patch)
tree99ee06cf363724dac56e6ea1d9d4b59c499a0998
parent5d8eb4437878df43dd4a41964cc25242a382cdf7 (diff)
include optimized sin/cos code for AVR only when on this platform
-rw-r--r--src/lib8tion/trig8.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib8tion/trig8.h b/src/lib8tion/trig8.h
index c5896ef8..bcb9f68a 100644
--- a/src/lib8tion/trig8.h
+++ b/src/lib8tion/trig8.h
@@ -16,9 +16,6 @@
#if defined(__AVR__)
#define sin16 sin16_avr
-#else
-#define sin16 sin16_C
-#endif
/// Fast 16-bit approximation of sin(x). This approximation never varies more than
/// 0.69% from the floating point value you'd get by doing
@@ -78,6 +75,9 @@ LIB8STATIC int16_t sin16_avr( uint16_t theta )
return y;
}
+#else
+#define sin16 sin16_C
+
/// Fast 16-bit approximation of sin(x). This approximation never varies more than
/// 0.69% from the floating point value you'd get by doing
///
@@ -109,6 +109,7 @@ LIB8STATIC int16_t sin16_C( uint16_t theta )
return y;
}
+#endif
/// Fast 16-bit approximation of cos(x). This approximation never varies more than
/// 0.69% from the floating point value you'd get by doing
@@ -139,15 +140,11 @@ LIB8STATIC int16_t cos16( uint16_t theta)
//
// On Arduino/AVR, this approximation is more than
// 20X faster than floating point sin(x) and cos(x)
+//
+const uint8_t b_m16_interleave[] = { 0, 49, 49, 41, 90, 27, 117, 10 };
#if defined(__AVR__) && !defined(LIB8_ATTINY)
#define sin8 sin8_avr
-#else
-#define sin8 sin8_C
-#endif
-
-
-const uint8_t b_m16_interleave[] = { 0, 49, 49, 41, 90, 27, 117, 10 };
/// Fast 8-bit approximation of sin(x). This approximation never varies more than
/// 2% from the floating point value you'd get by doing
@@ -206,6 +203,8 @@ LIB8STATIC uint8_t sin8_avr( uint8_t theta)
return y;
}
+#else
+#define sin8 sin8_C
/// Fast 8-bit approximation of sin(x). This approximation never varies more than
/// 2% from the floating point value you'd get by doing
@@ -243,6 +242,8 @@ LIB8STATIC uint8_t sin8_C( uint8_t theta)
return y;
}
+#endif
+
/// Fast 8-bit approximation of cos(x). This approximation never varies more than
/// 2% from the floating point value you'd get by doing
///