MySQL 8.3.0
Source Code Documentation
int2str.h File Reference
#include <cstdint>
#include "mysql/strings/api.h"

Go to the source code of this file.

Functions

MYSQL_STRINGS_EXPORT char * ll2str (int64_t val, char *dst, int radix, bool upcase)
 Converts a 64-bit integer value to its character form and moves it to the destination buffer followed by a terminating NUL. More...
 
MYSQL_STRINGS_EXPORT char * longlong10_to_str (int64_t val, char *dst, int radix)
 Converts a 64-bit integer to its string representation in decimal notation. More...
 
static char * longlong2str (int64_t val, char *dst, int radix)
 
static char * llstr (long long value, char *buff)
 
static char * ullstr (long long value, char *buff)
 

Function Documentation

◆ ll2str()

MYSQL_STRINGS_EXPORT char * ll2str ( int64_t  val,
char *  dst,
int  radix,
bool  upcase 
)

Converts a 64-bit integer value to its character form and moves it to the destination buffer followed by a terminating NUL.

If radix is -2..-36, val is taken to be SIGNED, if radix is 2..36, val is taken to be UNSIGNED. That is, val is signed if and only if radix is. All other radixes are treated as bad and nothing will be changed in this case.

For conversion to decimal representation (radix is -10 or 10) one should use the optimized longlong10_to_str() function instead.

Parameters
valthe value to convert
dstthe buffer where the string representation should be stored
radixradix of scale of notation
upcasetrue if we should use upper-case digits
Returns
pointer to the ending NUL character, or nullptr if radix is bad

◆ llstr()

static char * llstr ( long long  value,
char *  buff 
)
inlinestatic

◆ longlong10_to_str()

MYSQL_STRINGS_EXPORT char * longlong10_to_str ( int64_t  val,
char *  dst,
int  radix 
)

Converts a 64-bit integer to its string representation in decimal notation.

It is optimized for the normal case of radix 10/-10. It takes only the sign of radix parameter into account and not its absolute value.

Parameters
valthe value to convert
dstthe buffer where the string representation should be stored
radix10 if val is unsigned, -10 if val is signed
Returns
pointer to the ending NUL character

◆ longlong2str()

static char * longlong2str ( int64_t  val,
char *  dst,
int  radix 
)
inlinestatic

◆ ullstr()

static char * ullstr ( long long  value,
char *  buff 
)
inlinestatic