-inline const char* get_digit_character()
-{
- static const char s_characters[19] =
- {
- '9'
- , '8'
- , '7'
- , '6'
- , '5'
- , '4'
- , '3'
- , '2'
- , '1'
- , '0'
- , '1'
- , '2'
- , '3'
- , '4'
- , '5'
- , '6'
- , '7'
- , '8'
- , '9'
- };
- static const char *s_mid = s_characters + 9;
-
- return s_mid;
-}
-
-inline const char* unsigned_integer_to_string(char* buf, size_t cchBuf, size_t i)
-{
- char* psz=buf + cchBuf - 1; // Set psz to last char
- *psz = 0; // Set terminating null
-
- do {
- size_t lsd = i % 10; // Get least significant
- // digit
-
- i /= 10; // Prepare for next most
- // significant digit
-
- --psz; // Move back
-
- *psz = get_digit_character()[lsd]; // Place the digit
-
- } while(i!=0 && psz>buf);
-
- return psz;
-}
-