7#ifndef ZEPHYR_INCLUDE_SYS_CBPRINTF_CXX_H_
8#define ZEPHYR_INCLUDE_SYS_CBPRINTF_CXX_H_
12static inline int z_cbprintf_cxx_is_pchar(
char *,
bool const_as_fixed)
14 ARG_UNUSED(const_as_fixed);
18static inline int z_cbprintf_cxx_is_pchar(
const char *,
bool const_as_fixed)
20 return const_as_fixed ? 0 : 1;
23static inline int z_cbprintf_cxx_is_pchar(
volatile char *,
bool const_as_fixed)
25 ARG_UNUSED(const_as_fixed);
29static inline int z_cbprintf_cxx_is_pchar(
const volatile char *,
bool const_as_fixed)
31 ARG_UNUSED(const_as_fixed);
35static inline int z_cbprintf_cxx_is_pchar(
unsigned char *,
bool const_as_fixed)
37 ARG_UNUSED(const_as_fixed);
41static inline int z_cbprintf_cxx_is_pchar(
const unsigned char *,
bool const_as_fixed)
43 return const_as_fixed ? 0 : 1;
46static inline int z_cbprintf_cxx_is_pchar(
volatile unsigned char *,
bool const_as_fixed)
48 ARG_UNUSED(const_as_fixed);
52static inline int z_cbprintf_cxx_is_pchar(
const volatile unsigned char *,
bool const_as_fixed)
54 ARG_UNUSED(const_as_fixed);
57static inline int z_cbprintf_cxx_is_pchar(
wchar_t *,
bool const_as_fixed)
59 ARG_UNUSED(const_as_fixed);
63static inline int z_cbprintf_cxx_is_pchar(
const wchar_t *,
bool const_as_fixed)
65 return const_as_fixed ? 0 : 1;
68static inline int z_cbprintf_cxx_is_pchar(
volatile wchar_t *,
bool const_as_fixed)
70 ARG_UNUSED(const_as_fixed);
74static inline int z_cbprintf_cxx_is_pchar(
const volatile wchar_t *,
bool const_as_fixed)
76 ARG_UNUSED(const_as_fixed);
80template <
typename T >
81static inline int z_cbprintf_cxx_is_pchar(T arg,
bool const_as_fixed)
84 _Pragma(
"GCC diagnostic push")
85 _Pragma("GCC diagnostic ignored \"-Wpointer-arith\"")
86 ARG_UNUSED(const_as_fixed);
88 _Pragma("GCC diagnostic pop")
92static inline
size_t z_cbprintf_cxx_arg_size(
float f)
96 return sizeof(double);
99template <
typename T >
100static inline size_t z_cbprintf_cxx_arg_size(T arg)
104 return MAX(
sizeof(T),
sizeof(
int));
108static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
float arg)
110 double d = (double)arg;
113 z_cbprintf_wcpy((
int *)dst, (
int *)p,
sizeof(
d) /
sizeof(
int));
116static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
void *p)
118 z_cbprintf_wcpy((
int *)dst, (
int *)&p,
sizeof(p) /
sizeof(
int));
121static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
char arg)
125 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
128static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
unsigned char arg)
132 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
135static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
signed char arg)
139 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
142static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
short arg)
146 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
149static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst,
unsigned short arg)
153 z_cbprintf_wcpy((
int *)dst, &tmp, 1);
156template <
typename T >
157static inline void z_cbprintf_cxx_store_arg(
uint8_t *dst, T arg)
159 size_t wlen = z_cbprintf_cxx_arg_size(arg) /
sizeof(int);
162 z_cbprintf_wcpy((
int *)dst, (
int *)p, wlen);
166static inline int z_cbprintf_cxx_is_longdouble(
long double arg)
172template <
typename T >
173static inline int z_cbprintf_cxx_is_longdouble(T arg)
181static inline size_t z_cbprintf_cxx_alignment(
float arg)
188static inline size_t z_cbprintf_cxx_alignment(
double arg)
195static inline size_t z_cbprintf_cxx_alignment(
long double arg)
202static inline size_t z_cbprintf_cxx_alignment(
long long arg)
209static inline size_t z_cbprintf_cxx_alignment(
unsigned long long arg)
216template <
typename T >
217static inline size_t z_cbprintf_cxx_alignment(T arg)
223template <
typename T1,
typename T2 >
224struct z_cbprintf_cxx_is_same_type {
230template <
typename T >
231struct z_cbprintf_cxx_is_same_type < T, T > {
237template <
typename T >
238struct z_cbprintf_cxx_remove_reference {
242template <
typename T >
243struct z_cbprintf_cxx_remove_reference < T & > {
247#if __cplusplus >= 201103L
248template <
typename T >
249struct z_cbprintf_cxx_remove_reference < T && > {
254template <
typename T >
255struct z_cbprintf_cxx_remove_cv {
259template <
typename T >
260struct z_cbprintf_cxx_remove_cv < const T > {
264template <
typename T >
265struct z_cbprintf_cxx_remove_cv < volatile T > {
269template <
typename T >
270struct z_cbprintf_cxx_remove_cv < const volatile T > {
275template <
typename T >
276struct z_cbprintf_cxx_is_array {
282template <
typename T >
283struct z_cbprintf_cxx_is_array < T[] > {
289template <
typename T,
size_t N >
290struct z_cbprintf_cxx_is_array < T[N] > {
297template <
typename T >
298struct z_cbprintf_cxx_remove_extent {
302template <
typename T >
303struct z_cbprintf_cxx_remove_extent < T[] > {
307template <
typename T,
size_t N >
308struct z_cbprintf_cxx_remove_extent < T[N] > {
irp nz macro MOVR cc d
Definition: asm-macro-32-bit-gnu.h:11
#define VA_STACK_MIN_ALIGN
Definition: cbprintf_internal.h:48
#define VA_STACK_ALIGN(type)
Definition: cbprintf_internal.h:52
#define MAX(a, b)
Obtain the maximum of two values.
Definition: util.h:326
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88