![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Simple function to convert integers to ascii strings and back. More...
Go to the source code of this file.
Functions | |
static size_t | gp_u32toa (char *dst, uint32_t val, bool null_terminate) |
Converts an unsigned 32bit integer into an ascii representation. | |
static size_t | gp_u64toa (char *dst, uint64_t val, bool null_terminate) |
Converts an unsigned 64bit integer into an ascii representation. | |
static size_t | gp_utoa (char *dst, unsigned int val, bool null_terminate) |
Converts an unsigned integer into an ascii representation. | |
static size_t | gp_lutoa (char *dst, unsigned long val, bool null_terminate) |
Converts an unsigned long into an ascii representation. | |
static size_t | gp_llutoa (char *dst, unsigned long long val, bool null_terminate) |
Converts an unsigned long long into an ascii representation. | |
static ssize_t | gp_atou32 (const char *src, size_t src_len, uint32_t *dst) |
Converts an ASCII string into an unsigned 32bit integer. | |
static ssize_t | gp_atou64 (const char *src, size_t src_len, uint64_t *dst) |
Converts an ASCII string into an unsigned 64bit integer. | |
static ssize_t | gp_atou (const char *src, size_t src_len, unsigned int *dst) |
Converts an ASCII string into an unsigned integer. | |
static ssize_t | gp_atolu (const char *src, size_t src_len, unsigned long *dst) |
Converts an ASCII string into an unsigned long. | |
static ssize_t | gp_atollu (const char *src, size_t src_len, unsigned long long *dst) |
Converts an ASCII string into an unsigned long long. | |
Simple function to convert integers to ascii strings and back.
Definition in file gp_strconv.h.
|
inlinestatic |
Converts an ASCII string into an unsigned long long.
Converts start of the string into an unsigned long long. The conversion stop either at the end of the string or at first non-numeric character.
src | A source string. The string must be either nul byte terminated or non-zero src_len has to be passed. |
src_len | A number of bytes in src, if zero the string is expected to be nul byte terminated. |
dst | A pointer to an unsigned long long. |
Definition at line 320 of file gp_strconv.h.
References gp_atou32(), and gp_atou64().
|
inlinestatic |
Converts an ASCII string into an unsigned long.
Converts start of the string into an unsigned long. The conversion stop either at the end of the string or at first non-numeric character.
src | A source string. The string must be either nul byte terminated or non-zero src_len has to be passed. |
src_len | A number of bytes in src, if zero the string is expected to be nul byte terminated. |
dst | A pointer to an unsigned long. |
Definition at line 296 of file gp_strconv.h.
References gp_atou32(), and gp_atou64().
|
inlinestatic |
Converts an ASCII string into an unsigned integer.
Converts start of the string into an unsigned integer. The conversion stop either at the end of the string or at first non-numeric character.
src | A source string. The string must be either nul byte terminated or non-zero src_len has to be passed. |
src_len | A number of bytes in src, if zero the string is expected to be nul byte terminated. |
dst | A pointer to an unsigned integer. |
Definition at line 272 of file gp_strconv.h.
References gp_atou32(), and gp_atou64().
|
inlinestatic |
Converts an ASCII string into an unsigned 32bit integer.
Converts start of the string into an unsigned 32bit integer. The conversion stop either at the end of the string or at first non-numeric character.
src | A source string. The string must be either nul byte terminated or non-zero src_len has to be passed. |
src_len | A number of bytes in src, if zero the string is expected to be nul byte terminated. |
dst | A pointer to an unsigned 32bit integer. |
Definition at line 196 of file gp_strconv.h.
Referenced by gp_atollu(), gp_atolu(), and gp_atou().
|
inlinestatic |
Converts an ASCII string into an unsigned 64bit integer.
Converts start of the string into an unsigned 64bit integer. The conversion stop either at the end of the string or at first non-numeric character.
src | A source string. The string must be either nul byte terminated or non-zero src_len has to be passed. |
src_len | A number of bytes in src, if zero the string is expected to be nul byte terminated. |
dst | A pointer to an unsigned 64bit integer. |
Definition at line 234 of file gp_strconv.h.
Referenced by gp_atollu(), gp_atolu(), and gp_atou().
|
inlinestatic |
Converts an unsigned long long into an ascii representation.
The buffer must be large enough to fit the value. You can run the function with NULL dst to get the exact buffer size for the conversion.
dst | A buffer to write the bytes into. If NULL no bytes are written. |
val | An unsigned integer value to be converted to ascii. |
null_terminate | If set the string is null terminated. |
Definition at line 169 of file gp_strconv.h.
References gp_u32toa(), and gp_u64toa().
|
inlinestatic |
Converts an unsigned long into an ascii representation.
The buffer must be large enough to fit the value. You can run the function with NULL dst to get the exact buffer size for the conversion.
dst | A buffer to write the bytes into. If NULL no bytes are written. |
val | An unsigned integer value to be converted to ascii. |
null_terminate | If set the string is null terminated. |
Definition at line 147 of file gp_strconv.h.
References gp_u32toa(), and gp_u64toa().
|
inlinestatic |
Converts an unsigned 32bit integer into an ascii representation.
The buffer must be large enough to fit the value. Maximal number of digits for unsigned 32bit integer is 10 not including the terminating nul character.
You can run the function with NULL dst to get the exact buffer size for the conversion.
dst | A buffer to write the bytes into. If NULL no bytes are written. |
val | An unsigned integer value to be converted to ascii. |
null_terminate | If set the string is null terminated. |
Definition at line 53 of file gp_strconv.h.
Referenced by gp_llutoa(), gp_lutoa(), and gp_utoa().
|
inlinestatic |
Converts an unsigned 64bit integer into an ascii representation.
The buffer must be large enough to fit the value. Maximal number of digits for unsigned 64bit integer is 20 not including the terminating nul character.
You can run the function with NULL dst to get the exact buffer size for the conversion.
dst | A buffer to write the bytes into. If NULL no bytes are written. |
val | An unsigned integer value to be converted to ascii. |
null_terminate | If set the string is null terminated. |
Definition at line 91 of file gp_strconv.h.
Referenced by gp_llutoa(), gp_lutoa(), and gp_utoa().
|
inlinestatic |
Converts an unsigned integer into an ascii representation.
The buffer must be large enough to fit the value. You can run the function with NULL dst to get the exact buffer size for the conversion.
dst | A buffer to write the bytes into. If NULL no bytes are written. |
val | An unsigned integer value to be converted to ascii. |
null_terminate | If set the string is null terminated. |
Definition at line 125 of file gp_strconv.h.
References gp_u32toa(), and gp_u64toa().