Skip to content

Commit 59a7827

Browse files
committed
Fix SFixAuto for two's complement
1 parent 7360f2d commit 59a7827

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/FixMath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,8 @@ constexpr SFix<sizeof(T)*8-1,0> toSInt(T val) {
13791379
@endcode
13801380
*/
13811381
template<int64_t value>
1382-
constexpr const FixMathPrivate::SFixByRange_t<0, value < 0 ? -value : value> SFixAuto() {
1383-
return FixMathPrivate::SFixByRange_t<0, value < 0 ? -value : value>::fromRaw(value);
1382+
constexpr const FixMathPrivate::SFixByRange_t<0, value < 0 ? -value : value+1> SFixAuto() {
1383+
return FixMathPrivate::SFixByRange_t<0, value < 0 ? -value : value+1>::fromRaw(value);
13841384
}
13851385

13861386
#include "FixMath_Autotests.h"

0 commit comments

Comments
 (0)