Fix String::itos/String::num_int64(INT64_MIN) output.
This commit is contained in:
parent
5988ae6cda
commit
d0868a8f40
1 changed files with 3 additions and 4 deletions
|
@ -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) {
|
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
||||||
|
|
||||||
bool sign = p_num < 0;
|
bool sign = p_num < 0;
|
||||||
int64_t num = ABS(p_num);
|
|
||||||
|
|
||||||
int64_t n = num;
|
int64_t n = p_num;
|
||||||
|
|
||||||
int chars = 0;
|
int chars = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -1114,9 +1113,9 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
||||||
s.resize(chars + 1);
|
s.resize(chars + 1);
|
||||||
CharType *c = s.ptrw();
|
CharType *c = s.ptrw();
|
||||||
c[chars] = 0;
|
c[chars] = 0;
|
||||||
n = num;
|
n = p_num;
|
||||||
do {
|
do {
|
||||||
int mod = n % base;
|
int mod = ABS(n % base);
|
||||||
if (mod >= 10) {
|
if (mod >= 10) {
|
||||||
char a = (capitalize_hex ? 'A' : 'a');
|
char a = (capitalize_hex ? 'A' : 'a');
|
||||||
c[--chars] = a + (mod - 10);
|
c[--chars] = a + (mod - 10);
|
||||||
|
|
Loading…
Reference in a new issue