Skip to content

Commit 1ef99e2

Browse files
committed
Try to avoid compiler warning for unary minus operator inside MathLib::toLongNumber<biguint>()
1 parent b4b340b commit 1ef99e2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎lib/mathlib.h‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <cstdlib>
2525
#include <string>
2626
#include <sstream>
27+
#include <type_traits>
2728
#include "config.h"
2829

2930
/// @addtogroup Core
@@ -69,8 +70,10 @@ class CPPCHECKLIB MathLib {
6970
if (str[i] == '1')
7071
ret |= 1;
7172
}
72-
if (str[0] == '-')
73-
ret = -ret;
73+
if (std::is_signed<T>()) {
74+
if (str[0] == '-')
75+
ret = -ret;
76+
}
7477
return ret;
7578
}
7679

0 commit comments

Comments
 (0)