Eradicate Warnings

pull/4/head
Pharap 7 years ago committed by GitHub
parent 393acd2f49
commit d2a63faf53
  1. 25
      src/FixedPoints/Details.h
  2. 15
      src/FixedPoints/SFixedMemberFunctions.h
  3. 1
      src/FixedPoints/UFixedMemberFunctions.h
  4. 4
      src/FixedPoints/Utils.h

@ -1,5 +1,6 @@
#pragma once
#include <Arduino.h>
#include <limits.h>
#include <stdint.h>
@ -203,17 +204,17 @@ namespace FIXED_POINTS_DETAILS
static inline int64_t Random() { return (static_cast<int64_t>(random()) << 32) | static_cast<int64_t>(random()); }
};
// Here be dragons!!
//
//
//
// /\___/\ ~
// ( O . O ) \\
// > ^ < //
// ( \ / )//
// u U U u
//
// Or cats?
// ~Mwrow~
///////////////////////
// Here be dragons!! //
// //
// /\___/\ _ //
// ( O . O ) \\ //
// > ^ < // //
// ( \ / )// //
// u U U u //
// //
// Or cats?... //
// ~Mwrow~ //
///////////////////////
}
FIXED_POINTS_END_NAMESPACE

@ -35,7 +35,7 @@ constexpr typename SFixed<Integer, Fraction>::InternalType SFixed<Integer, Fract
template< unsigned Integer, unsigned Fraction >
constexpr typename SFixed<Integer, Fraction>::IntegerType SFixed<Integer, Fraction>::getInteger(void) const
{
return static_cast<IntegerType>(this->value >> IntegerShift) & IntegerMask | ((this->value < 0) ? ~IntegerMask : 0);
return (static_cast<IntegerType>(this->value >> IntegerShift) & IntegerMask) | ((this->value < 0) ? ~IntegerMask : 0);
}
template< unsigned Integer, unsigned Fraction >
@ -57,10 +57,6 @@ constexpr SFixed<Integer, Fraction>::operator IntegerType(void) const
template< unsigned Integer, unsigned Fraction >
constexpr SFixed<Integer, Fraction>::operator float(void) const
{
/*return (1.0f / Scale) *
(this->value < 0) ?
-((-this->value) & IdentityMask) :
this->value & IdentityMask; */
return (1.0f / Scale) *
static_cast<InternalType>
((this->value & IdentityMask) |
@ -70,10 +66,6 @@ constexpr SFixed<Integer, Fraction>::operator float(void) const
template< unsigned Integer, unsigned Fraction >
constexpr SFixed<Integer, Fraction>::operator double(void) const
{
/*return (1.0 / Scale) *
(this->value < 0) ?
-((-this->value) & IdentityMask) :
this->value & IdentityMask; */
return (1.0 / Scale) *
static_cast<InternalType>
((this->value & IdentityMask) |
@ -84,12 +76,11 @@ template< unsigned Integer, unsigned Fraction >
template< unsigned IntegerOut, unsigned FractionOut >
constexpr SFixed<Integer, Fraction>::operator SFixed<IntegerOut, FractionOut>(void) const
{
using OutputType = UFixed<IntegerOut, FractionOut>;
using OutputType = SFixed<IntegerOut, FractionOut>;
using OutputInternalType = typename OutputType::InternalType;
using OutputShiftType = typename OutputType::ShiftType;
using InputType = UFixed<Integer, Fraction>;
using InputInternalType = typename InputType::InternalType;
using InputType = SFixed<Integer, Fraction>;
using InputShiftType = typename InputType::ShiftType;
return

@ -75,7 +75,6 @@ constexpr UFixed<Integer, Fraction>::operator UFixed<IntegerOut, FractionOut>(vo
using OutputShiftType = typename OutputType::ShiftType;
using InputType = UFixed<Integer, Fraction>;
using InputInternalType = typename InputType::InternalType;
using InputShiftType = typename InputType::ShiftType;
return

@ -116,8 +116,8 @@ constexpr SFixed<Integer, Fraction> roundFixed(const SFixed<Integer, Fraction> &
return
(
((value.getInternal() & OutputType::MidpointMask) != 0) &&
!signbitFixed(value) ||
((value.getInternal() & OutputType::LesserMidpointMask) != 0)
(!signbitFixed(value) ||
((value.getInternal() & OutputType::LesserMidpointMask) != 0))
)
? ceilFixed(value)
: floorFixed(value);

Loading…
Cancel
Save