2022-01-19 05:35:02 -05:00
|
|
|
#ifndef KERNAUX_INCLUDED_NTOA
|
|
|
|
#define KERNAUX_INCLUDED_NTOA
|
2021-12-15 05:45:40 -05:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-01-18 02:39:28 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-06-01 08:45:36 -04:00
|
|
|
#define KERNAUX_NTOA_MAX_PREFIX_LEN 100
|
|
|
|
|
2022-05-30 16:11:16 -04:00
|
|
|
#define KERNAUX_NTOA_DEFAULT_PREFIX_2 "0b"
|
2022-05-30 15:33:53 -04:00
|
|
|
#define KERNAUX_NTOA_DEFAULT_PREFIX_8 "0o"
|
2022-05-30 10:04:35 -04:00
|
|
|
#define KERNAUX_NTOA_DEFAULT_PREFIX_16 "0x"
|
|
|
|
|
2022-01-24 11:30:58 -05:00
|
|
|
// "1111111111111111111111111111111111111111111111111111111111111111"
|
2022-05-30 09:28:46 -04:00
|
|
|
#define KERNAUX_UTOA_MIN_BUFFER_SIZE (64 + 1)
|
2022-01-23 22:30:43 -05:00
|
|
|
|
2022-01-24 11:30:58 -05:00
|
|
|
// "111111111111111111111111111111111111111111111111111111111111111"
|
|
|
|
// "-1000000000000000000000000000000000000000000000000000000000000000"
|
2022-05-30 09:28:46 -04:00
|
|
|
#define KERNAUX_ITOA_MIN_BUFFER_SIZE (65 + 1)
|
2022-01-24 11:25:01 -05:00
|
|
|
|
2022-05-30 16:11:16 -04:00
|
|
|
// "0b1111111111111111111111111111111111111111111111111111111111111111"
|
|
|
|
#define KERNAUX_UTOA2_BUFFER_SIZE (64 + 2 + 1)
|
|
|
|
|
|
|
|
// "0b111111111111111111111111111111111111111111111111111111111111111"
|
|
|
|
// "-0b1000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
#define KERNAUX_ITOA2_BUFFER_SIZE (65 + 2 + 1)
|
|
|
|
|
2022-05-30 15:33:53 -04:00
|
|
|
// "0o1777777777777777777777"
|
|
|
|
#define KERNAUX_UTOA8_BUFFER_SIZE (21 + 2 + 1)
|
|
|
|
|
|
|
|
// "0o777777777777777777777"
|
|
|
|
// "-0o1000000000000000000000"
|
|
|
|
#define KERNAUX_ITOA8_BUFFER_SIZE (22 + 2 + 1)
|
|
|
|
|
2022-01-23 16:59:54 -05:00
|
|
|
// "18446744073709551615"
|
2022-05-30 08:07:35 -04:00
|
|
|
#define KERNAUX_UTOA10_BUFFER_SIZE (20 + 1)
|
2022-01-23 16:59:54 -05:00
|
|
|
|
|
|
|
// "9223372036854775807"
|
|
|
|
// "-9223372036854775808"
|
2022-05-30 08:07:35 -04:00
|
|
|
#define KERNAUX_ITOA10_BUFFER_SIZE (20 + 1)
|
2022-01-18 02:39:28 -05:00
|
|
|
|
2022-05-30 10:04:35 -04:00
|
|
|
// "0xffffffffffffffff"
|
|
|
|
#define KERNAUX_UTOA16_BUFFER_SIZE (16 + 2 + 1)
|
2022-01-23 16:59:54 -05:00
|
|
|
|
2022-05-30 10:04:35 -04:00
|
|
|
// "0x7fffffffffffffff"
|
|
|
|
// "-0x8000000000000000"
|
|
|
|
#define KERNAUX_ITOA16_BUFFER_SIZE (17 + 2 + 1)
|
2022-01-23 16:40:13 -05:00
|
|
|
|
2022-05-30 05:49:58 -04:00
|
|
|
char *kernaux_utoa(uint64_t value, char *buffer, int base, const char *prefix);
|
|
|
|
char *kernaux_itoa(int64_t value, char *buffer, int base, const char *prefix);
|
2022-01-23 22:30:43 -05:00
|
|
|
|
2022-05-30 16:11:16 -04:00
|
|
|
char *kernaux_utoa2(uint64_t value, char *buffer);
|
|
|
|
char *kernaux_itoa2(int64_t value, char *buffer);
|
|
|
|
|
2022-05-30 15:33:53 -04:00
|
|
|
char *kernaux_utoa8(uint64_t value, char *buffer);
|
|
|
|
char *kernaux_itoa8(int64_t value, char *buffer);
|
|
|
|
|
2022-05-30 09:37:53 -04:00
|
|
|
char *kernaux_utoa10(uint64_t value, char *buffer);
|
|
|
|
char *kernaux_itoa10(int64_t value, char *buffer);
|
2022-01-18 02:39:28 -05:00
|
|
|
|
2022-05-30 09:37:53 -04:00
|
|
|
char *kernaux_utoa16(uint64_t value, char *buffer);
|
|
|
|
char *kernaux_itoa16(int64_t value, char *buffer);
|
2022-01-23 16:40:13 -05:00
|
|
|
|
2021-12-15 05:45:40 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|