aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaruncz <marun1@email.cz>2021-04-21 15:08:15 +0200
committermaruncz <marun1@email.cz>2021-04-21 15:08:15 +0200
commitedcfdea949d0c73ee86738f3211a59baaf722101 (patch)
treec0ffb2b7c429bc2842e340d1080db13a7232c532
parent7541eae325e4b0765cc6c1908287efca237e7fc7 (diff)
fixed some warnings
-rw-r--r--libfixmath/fix16.hpp80
-rw-r--r--libfixmath/fix16_exp.c3
2 files changed, 41 insertions, 42 deletions
diff --git a/libfixmath/fix16.hpp b/libfixmath/fix16.hpp
index dc8a5b7..95f6f9a 100644
--- a/libfixmath/fix16.hpp
+++ b/libfixmath/fix16.hpp
@@ -8,11 +8,11 @@ class Fix16 {
fix16_t value;
Fix16() { value = 0; }
- Fix16(const Fix16 &inValue) { value = inValue.value; }
- Fix16(const fix16_t inValue) { value = inValue; }
- Fix16(const float inValue) { value = fix16_from_float(inValue); }
- Fix16(const double inValue) { value = fix16_from_dbl(inValue); }
- Fix16(const int16_t inValue) { value = fix16_from_int(inValue); }
+ Fix16(const Fix16 &inValue) { value = inValue.value; }
+ Fix16(const fix16_t inValue) { value = inValue; }
+ Fix16(const float inValue) { value = fix16_from_float(inValue); }
+ Fix16(const double inValue) { value = fix16_from_dbl(inValue); }
+ Fix16(const int16_t inValue) { value = fix16_from_int(inValue); }
operator fix16_t() const { return value; }
operator double() const { return fix16_to_dbl(value); }
@@ -105,41 +105,41 @@ class Fix16 {
const Fix16 sdiv(const int16_t other) const { Fix16 ret = fix16_sdiv(value, fix16_from_int(other)); return ret; }
#endif
- const int operator==(const Fix16 &other) const { return (value == other.value); }
- const int operator==(const fix16_t other) const { return (value == other); }
- const int operator==(const double other) const { return (value == fix16_from_dbl(other)); }
- const int operator==(const float other) const { return (value == fix16_from_float(other)); }
- const int operator==(const int16_t other) const { return (value == fix16_from_int(other)); }
-
- const int operator!=(const Fix16 &other) const { return (value != other.value); }
- const int operator!=(const fix16_t other) const { return (value != other); }
- const int operator!=(const double other) const { return (value != fix16_from_dbl(other)); }
- const int operator!=(const float other) const { return (value != fix16_from_float(other)); }
- const int operator!=(const int16_t other) const { return (value != fix16_from_int(other)); }
-
- const int operator<=(const Fix16 &other) const { return (value <= other.value); }
- const int operator<=(const fix16_t other) const { return (value <= other); }
- const int operator<=(const double other) const { return (value <= fix16_from_dbl(other)); }
- const int operator<=(const float other) const { return (value <= fix16_from_float(other)); }
- const int operator<=(const int16_t other) const { return (value <= fix16_from_int(other)); }
-
- const int operator>=(const Fix16 &other) const { return (value >= other.value); }
- const int operator>=(const fix16_t other) const { return (value >= other); }
- const int operator>=(const double other) const { return (value >= fix16_from_dbl(other)); }
- const int operator>=(const float other) const { return (value >= fix16_from_float(other)); }
- const int operator>=(const int16_t other) const { return (value >= fix16_from_int(other)); }
-
- const int operator< (const Fix16 &other) const { return (value < other.value); }
- const int operator< (const fix16_t other) const { return (value < other); }
- const int operator< (const double other) const { return (value < fix16_from_dbl(other)); }
- const int operator< (const float other) const { return (value < fix16_from_float(other)); }
- const int operator< (const int16_t other) const { return (value < fix16_from_int(other)); }
-
- const int operator> (const Fix16 &other) const { return (value > other.value); }
- const int operator> (const fix16_t other) const { return (value > other); }
- const int operator> (const double other) const { return (value > fix16_from_dbl(other)); }
- const int operator> (const float other) const { return (value > fix16_from_float(other)); }
- const int operator> (const int16_t other) const { return (value > fix16_from_int(other)); }
+ int operator==(const Fix16 &other) const { return (value == other.value); }
+ int operator==(const fix16_t other) const { return (value == other); }
+ int operator==(const double other) const { return (value == fix16_from_dbl(other)); }
+ int operator==(const float other) const { return (value == fix16_from_float(other)); }
+ int operator==(const int16_t other) const { return (value == fix16_from_int(other)); }
+
+ int operator!=(const Fix16 &other) const { return (value != other.value); }
+ int operator!=(const fix16_t other) const { return (value != other); }
+ int operator!=(const double other) const { return (value != fix16_from_dbl(other)); }
+ int operator!=(const float other) const { return (value != fix16_from_float(other)); }
+ int operator!=(const int16_t other) const { return (value != fix16_from_int(other)); }
+
+ int operator<=(const Fix16 &other) const { return (value <= other.value); }
+ int operator<=(const fix16_t other) const { return (value <= other); }
+ int operator<=(const double other) const { return (value <= fix16_from_dbl(other)); }
+ int operator<=(const float other) const { return (value <= fix16_from_float(other)); }
+ int operator<=(const int16_t other) const { return (value <= fix16_from_int(other)); }
+
+ int operator>=(const Fix16 &other) const { return (value >= other.value); }
+ int operator>=(const fix16_t other) const { return (value >= other); }
+ int operator>=(const double other) const { return (value >= fix16_from_dbl(other)); }
+ int operator>=(const float other) const { return (value >= fix16_from_float(other)); }
+ int operator>=(const int16_t other) const { return (value >= fix16_from_int(other)); }
+
+ int operator< (const Fix16 &other) const { return (value < other.value); }
+ int operator< (const fix16_t other) const { return (value < other); }
+ int operator< (const double other) const { return (value < fix16_from_dbl(other)); }
+ int operator< (const float other) const { return (value < fix16_from_float(other)); }
+ int operator< (const int16_t other) const { return (value < fix16_from_int(other)); }
+
+ int operator> (const Fix16 &other) const { return (value > other.value); }
+ int operator> (const fix16_t other) const { return (value > other); }
+ int operator> (const double other) const { return (value > fix16_from_dbl(other)); }
+ int operator> (const float other) const { return (value > fix16_from_float(other)); }
+ int operator> (const int16_t other) const { return (value > fix16_from_int(other)); }
Fix16 sin() const { return Fix16(fix16_sin(value)); }
Fix16 cos() const { return Fix16(fix16_cos(value)); }
diff --git a/libfixmath/fix16_exp.c b/libfixmath/fix16_exp.c
index 747e77d..e804da1 100644
--- a/libfixmath/fix16_exp.c
+++ b/libfixmath/fix16_exp.c
@@ -15,8 +15,7 @@ fix16_t fix16_exp(fix16_t inValue) {
if(inValue <= -772243 ) return 0;
#ifndef FIXMATH_NO_CACHE
- fix16_t tempIndex = (inValue ^ (inValue >> 16));
- tempIndex = (inValue ^ (inValue >> 4)) & 0x0FFF;
+ fix16_t tempIndex = (inValue ^ (inValue >> 4)) & 0x0FFF;
if(_fix16_exp_cache_index[tempIndex] == inValue)
return _fix16_exp_cache_value[tempIndex];
#endif