MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / num_uint64

Method num_uint64

modules/gui/gui/src/backend/text_server/ustring.cpp:1889–1922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1887}
1888
1889String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex)
1890{
1891 uint64_t n = p_num;
1892
1893 int chars = 0;
1894 do
1895 {
1896 n /= base;
1897 chars++;
1898 } while (n);
1899
1900 String s;
1901 s.resize(chars + 1);
1902 char32_t* c = s.ptrw();
1903 c[chars] = 0;
1904 n = p_num;
1905 do
1906 {
1907 int mod = n % base;
1908 if (mod >= 10)
1909 {
1910 char a = (capitalize_hex ? 'A' : 'a');
1911 c[--chars] = a + (mod - 10);
1912 }
1913 else
1914 {
1915 c[--chars] = '0' + mod;
1916 }
1917
1918 n /= base;
1919 } while (n);
1920
1921 return s;
1922}
1923
1924String String::num_real(double p_num, bool p_trailing)
1925{

Callers

nothing calls this directly

Calls 2

resizeMethod · 0.45
ptrwMethod · 0.45

Tested by

no test coverage detected