fixed some warnings

This commit is contained in:
maruncz 2021-04-21 15:08:15 +02:00
parent 7541eae325
commit edcfdea949
2 changed files with 36 additions and 37 deletions

View File

@ -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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
Fix16 sin() const { return Fix16(fix16_sin(value)); }
Fix16 cos() const { return Fix16(fix16_cos(value)); }

View File

@ -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