Skip to content

Commit

Permalink
Fixed compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcombriat committed Nov 15, 2023
1 parent 9f2718e commit fdeb17a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions FixMath2.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "IntegerType.h"

#define SHIFTR(x,bits) (bits > 0 ? x >> (bits) : x << (-bits)) // shift right for positive shift numbers, and left for negative ones.
#define SHIFTR(x,bits) (bits > 0 ? (x >> (bits)) : (x << (-bits))) // shift right for positive shift numbers, and left for negative ones.
#define MAX(N1,N2) (N1 > N2 ? N1 : N2)

template<byte NI, byte NF> // NI and NF being the number of bits for the integral and the fractionnal parts respectively.
Expand Down Expand Up @@ -60,13 +60,20 @@ class UFixMath2


// Multiplication overload, returns the compound type
template<byte _NI, byte _NF>
UFixMath2<NI+_NI,NF+_NF> operator* (const UFixMath2<_NI,_NF>& op)
/* template<byte _NI, byte _NF>
const UFixMath2<NI+_NI,NF+_NF> operator* (const UFixMath2<_NI,_NF>& op)
{
typedef typename IntegerType< ((NI+_NI+NF+_NF-1)>>3)+1>::unsigned_type return_type ;
return_type tt = return_type(internal_value)*op.getInt();
return UFixMath2<NI+_NI,NF+_NF>(tt,true);
}*/

template<byte _NI, byte _NF>
UFixMath2<NI+_NI,NF+_NF> operator* (const UFixMath2<_NI,_NF>& op) const
{
typedef typename IntegerType< ((NI+_NI+NF+_NF-1)>>3)+1>::unsigned_type return_type ;
return_type tt = return_type(internal_value)*op.getInt();
return UFixMath2<NI+_NI,NF+_NF>(tt,true);
}


Expand All @@ -85,7 +92,7 @@ class UFixMath2


float asFloat() { return (static_cast<float>(internal_value)) / (next_greater_type(1)<<NF); }
internal_type getInt() { return internal_value; }
internal_type getInt() const { return internal_value; }


/* byte getNI(){return NI;}
Expand Down

0 comments on commit fdeb17a

Please sign in to comment.