#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "format.h"
Go to the source code of this file.
|
| bool | format_i64 (char *dst, size_t dst_len, const int64_t value) |
| bool | format_u64 (char *out, size_t outLen, uint64_t in) |
| bool | format_fpu64 (char *dst, size_t dst_len, const uint64_t value, uint8_t decimals) |
| bool | format_fpu64_trimmed (char *dst, size_t dst_len, const uint64_t value, uint8_t decimals) |
| int | format_hex (const uint8_t *in, size_t in_len, char *out, size_t out_len) |
◆ format_fpu64()
| bool format_fpu64 |
( |
char * | dst, |
|
|
size_t | dst_len, |
|
|
const uint64_t | value, |
|
|
uint8_t | decimals ) |
Format 64-bit unsigned integer as string with decimals.
- Parameters
-
| [out] | dst | Pointer to output string. |
| [in] | dst_len | Length of output string. |
| [in] | value | 64-bit unsigned integer to format. |
| [in] | decimals | Number of digits after decimal separator. |
- Returns
- true if success, false otherwise.
Definition at line 101 of file format.c.
◆ format_fpu64_trimmed()
| bool format_fpu64_trimmed |
( |
char * | dst, |
|
|
size_t | dst_len, |
|
|
const uint64_t | value, |
|
|
uint8_t | decimals ) |
Format 64-bit unsigned integer as string with decimals and trimmed zeros and dot.
- Parameters
-
| [out] | dst | Pointer to output string. |
| [in] | dst_len | Length of output string. |
| [in] | value | 64-bit unsigned integer to format. |
| [in] | decimals | Number of digits after decimal separator. |
- Returns
- true if success, false otherwise.
Definition at line 144 of file format.c.
◆ format_hex()
| int format_hex |
( |
const uint8_t * | in, |
|
|
size_t | in_len, |
|
|
char * | out, |
|
|
size_t | out_len ) |
Format byte buffer to uppercase hexadecimal string.
- Parameters
-
| [in] | in | Pointer to input byte buffer. |
| [in] | in_len | Length of input byte buffer. |
| [out] | out | Pointer to output string. |
| [in] | out_len | Length of output string. |
- Returns
- number of bytes written if success, -1 otherwise.
Definition at line 167 of file format.c.
◆ format_i64()
| bool format_i64 |
( |
char * | dst, |
|
|
size_t | dst_len, |
|
|
const int64_t | value ) |
Format 64-bit signed integer as string.
- Parameters
-
| [out] | dst | Pointer to output string. |
| [in] | dst_len | Length of output string. |
| [in] | value | 64-bit signed integer to format. |
- Returns
- true if success, false otherwise.
Definition at line 24 of file format.c.
◆ format_u64()
| bool format_u64 |
( |
char * | dst, |
|
|
size_t | dst_len, |
|
|
uint64_t | value ) |
Format 64-bit unsigned integer as string.
- Parameters
-
| [out] | dst | Pointer to output string. |
| [in] | dst_len | Length of output string. |
| [in] | value | 64-bit unsigned integer to format. |
- Returns
- true if success, false otherwise.
Definition at line 65 of file format.c.