diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-02-25 21:51:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-25 21:51:11 +0100 |
commit | 7568a455397aeefc1e08600534ec4df279abab70 (patch) | |
tree | 2ae483b9c89320bacd7e6ad1939448d9741ba0d9 /core/ustring.cpp | |
parent | 125fc8cc4432d28e63da76c3a2aff655b1a7cc6b (diff) | |
parent | f37090ccf4f699800a43878273b8b94b5906f4bc (diff) |
Merge pull request #17020 from neikeq/cs-api-asm-checks
Mono: Better versioning and gracefully unloading of Godot API assemblies
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index d445e4ed47..a7a7810837 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1135,6 +1135,36 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) { return s; } +String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) { + + uint64_t n = p_num; + + int chars = 0; + do { + n /= base; + chars++; + } while (n); + + String s; + s.resize(chars + 1); + CharType *c = s.ptrw(); + c[chars] = 0; + n = p_num; + do { + int mod = ABS(n % base); + if (mod >= 10) { + char a = (capitalize_hex ? 'A' : 'a'); + c[--chars] = a + (mod - 10); + } else { + c[--chars] = '0' + mod; + } + + n /= base; + } while (n); + + return s; +} + String String::num_real(double p_num) { String s; |