diff --git a/src/FixedPoints/SFixedFreeFunctions.h b/src/FixedPoints/SFixedFreeFunctions.h index fcf8d71..1fc3fe2 100644 --- a/src/FixedPoints/SFixedFreeFunctions.h +++ b/src/FixedPoints/SFixedFreeFunctions.h @@ -28,6 +28,26 @@ constexpr SFixed multiply(const SFixed(static_cast(left.getInternal()) * static_cast(right.getInternal()))); } +// +// Postincrement and Postdecrement +// + +template< unsigned Integer, unsigned Fraction > +SFixed operator ++(SFixed & value, int) +{ + const auto oldValue = value; + ++value; + return oldValue; +} + +template< unsigned Integer, unsigned Fraction > +SFixed operator --(SFixed & value, int) +{ + const auto oldValue = value; + --value; + return oldValue; +} + // // Basic Logic Operations // diff --git a/src/FixedPoints/UFixedFreeFunctions.h b/src/FixedPoints/UFixedFreeFunctions.h index a424bec..0bfca01 100644 --- a/src/FixedPoints/UFixedFreeFunctions.h +++ b/src/FixedPoints/UFixedFreeFunctions.h @@ -28,6 +28,26 @@ constexpr UFixed multiply(const UFixed(static_cast(left.getInternal()) * static_cast(right.getInternal()))); } +// +// Postincrement and Postdecrement +// + +template< unsigned Integer, unsigned Fraction > +UFixed operator ++(UFixed & value, int) +{ + const auto oldValue = value; + ++value; + return oldValue; +} + +template< unsigned Integer, unsigned Fraction > +UFixed operator --(UFixed & value, int) +{ + const auto oldValue = value; + --value; + return oldValue; +} + // // Basic Logic Operations //