diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-01-13 21:25:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-13 21:25:43 +0100 |
commit | 6a4521da2ae0b08f42001c2c38396b28a2549c14 (patch) | |
tree | 860baa602f6b277750fdacf7c9d980cca6499472 | |
parent | e15ee649b89e31c7a4066702bfa6e76362a79ffd (diff) | |
parent | d0868a8f402fea0d0e56f3903dccc0b51f19f3e0 (diff) |
Merge pull request #15679 from bruvzg/fix_itos_on_int64_min
Fix String::itos/String::num_int64(INT64_MIN) output.
-rw-r--r-- | core/ustring.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 528ecc52db..1be828c44a 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1098,9 +1098,8 @@ String String::num(double p_num, int p_decimals) { String String::num_int64(int64_t p_num, int base, bool capitalize_hex) { bool sign = p_num < 0; - int64_t num = ABS(p_num); - int64_t n = num; + int64_t n = p_num; int chars = 0; do { @@ -1114,9 +1113,9 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) { s.resize(chars + 1); CharType *c = s.ptrw(); c[chars] = 0; - n = num; + n = p_num; do { - int mod = n % base; + int mod = ABS(n % base); if (mod >= 10) { char a = (capitalize_hex ? 'A' : 'a'); c[--chars] = a + (mod - 10); |