![]() |
MySQL 9.5.0
Source Code Documentation
|
This file contains utilities for accessing digits of integers, and for converting them to strings. More...
#include <assert.h>#include <algorithm>#include <limits>#include <type_traits>#include "mysql/attribute.h"Go to the source code of this file.
Classes | |
| class | TwoDigitWriter |
| Helper class for write_two_digits(), which creates a table that maps every integer from 0 to 99 to a two-char sequence that represents its two base 10 digits. More... | |
| struct | DigitCounter< T, MinDigits, MaxDigits, typename > |
| Functor that calculates the number of digits in an unsigned integer using binary search. More... | |
| struct | DigitCounter< T, MinDigits, MaxDigits, typename std::enable_if< MinDigits==MaxDigits >::type > |
| Counts the number of digits for the trivial case where the known minimum number of digits is equal to the known maximum number of digits. More... | |
Functions | |
| char * | write_two_digits (int value, char *to) |
| Writes an integer, which is between 0 (inclusive) and 100 (exclusive), to a string in base 10. More... | |
| template<typename T > | |
| constexpr int | count_digits (T x) |
| Counts the number of base 10 digits in an unsigned integer. More... | |
| template<typename T > | |
| char * | write_digits (T number, int digits, char *to) |
| Writes an unsigned integer of the specified length to a string. More... | |
This file contains utilities for accessing digits of integers, and for converting them to strings.
Counts the number of base 10 digits in an unsigned integer.
| x | the number whose digits to count |
Writes an unsigned integer of the specified length to a string.
The string is not zero-terminated.
| number | the number to write | |
| digits | the number of digits to write (the number is zero-padded if it is shorter) | |
| [in,out] | to | the destination string |
|
inline |
Writes an integer, which is between 0 (inclusive) and 100 (exclusive), to a string in base 10.
Always writes two digits, zero-padded if necessary. The string is not zero-terminated.
| value | the number to write | |
| [in,out] | to | the destination string |