Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
dpl_types.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 Inria
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
20
#ifndef DPL_DPL_TYPES_H
21
#define DPL_DPL_TYPES_H
22
23
#include <stdint.h>
24
#include <
math.h
>
25
26
#include "
os/os_types.h
"
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
31
35
#ifndef M_PI
36
#define M_PI 3.1415926535
37
#endif
38
43
#define DPL_TIMEOUT_NEVER (OS_TIMEOUT_NEVER)
44
#define DPL_WAIT_FOREVER (OS_WAIT_FOREVER)
51
#define DPL_STACK_ALIGNMENT (OS_ALIGNMENT)
57
typedef
os_time_t
dpl_time_t
;
58
62
typedef
os_stack_t
dpl_stack_t
;
63
67
typedef
float
dpl_float32_t
;
71
typedef
double
dpl_float64_t
;
72
77
#define DPL_FLOAT32_INIT(__X) ((float)__X)
78
#define DPL_FLOAT64_INIT(__X) ((double)__X)
79
#define DPL_FLOAT64TO32(__X) (float)(__X)
80
#define DPL_FLOAT32_I32_TO_F32(__X) (float)(__X)
81
#define DPL_FLOAT64_I32_TO_F64(__X) ((double)(__X))
82
#define DPL_FLOAT64_I64_TO_F64(__X) ((double)(__X))
83
#define DPL_FLOAT64_U64_TO_F64(__X) ((double)(__X))
84
#define DPL_FLOAT64_F64_TO_U64(__X) ((uint64_t)(__X))
85
#define DPL_FLOAT32_INT(__X) ((int32_t)__X)
86
#define DPL_FLOAT64_INT(__X) ((int64_t)__X)
87
#define DPL_FLOAT64_FROM_F32(__X) (double)(__X)
88
#define DPL_FLOAT32_FROM_F64(__X) (float)(__X)
89
#define DPL_FLOAT32_CEIL(__X) (ceilf(__X))
90
#define DPL_FLOAT64_CEIL(__X) (ceil(__X))
91
#define DPL_FLOAT32_FABS(__X) fabsf(__X)
92
#define DPL_FLOAT32_FMOD(__X, __Y) fmodf(__X, __Y)
93
#define DPL_FLOAT64_FMOD(__X, __Y) fmod(__X, __Y)
94
#define DPL_FLOAT32_NAN() nanf("")
95
#define DPL_FLOAT64_NAN() nan("")
96
#define DPL_FLOAT32_ISNAN(__X) isnan(__X)
97
#define DPL_FLOAT64_ISNAN(__X) DPL_FLOAT32_ISNAN(__X)
98
#define DPL_FLOAT32_LOG10(__X) (log10f(__X))
99
#define DPL_FLOAT64_LOG10(__X) (log10(__X))
100
#define DPL_FLOAT64_ASIN(__X) asin(__X)
101
#define DPL_FLOAT64_ATAN(__X) atan(__X)
102
#define DPL_FLOAT32_SUB(__X, __Y) ((__X)-(__Y))
103
#define DPL_FLOAT64_SUB(__X, __Y) ((__X)-(__Y))
104
#define DPL_FLOAT32_ADD(__X, __Y) ((__X)+(__Y))
105
#define DPL_FLOAT64_ADD(__X, __Y) ((__X)+(__Y))
106
#define DPL_FLOAT32_MUL(__X, __Y) ((__X)*(__Y))
107
#define DPL_FLOAT64_MUL(__X, __Y) ((__X)*(__Y))
108
#define DPL_FLOAT32_DIV(__X, __Y) ((__X)/(__Y))
109
#define DPL_FLOAT64_DIV(__X, __Y) ((__X)/(__Y))
110
#define DPL_FLOAT32_PRINTF_PRIM "%s%d.%03d"
111
#define DPL_FLOAT32_PRINTF_VALS(__X) (__X)<0?"-":"", (int)(fabsf(__X)), (int)(fabsf((__X)-(int)(__X))*1000)
112
#define DPL_FLOAT64_PRINTF_PRIM "%s%d.%06d"
113
#define DPL_FLOAT64_PRINTF_VALS(__X) (__X)<0?"-":"", (int)(fabs(__X)), (int)(fabs((__X)-(int)(__X))*1000000)
116
#ifdef __cplusplus
117
}
118
#endif
119
120
#endif
/* DPL_DPL_TYPES_H */
dpl_time_t
os_time_t dpl_time_t
dpl time type
Definition
dpl_types.h:57
dpl_float64_t
double dpl_float64_t
dpl float 64 type
Definition
dpl_types.h:71
dpl_stack_t
os_stack_t dpl_stack_t
dpl stack buffer type
Definition
dpl_types.h:62
dpl_float32_t
float dpl_float32_t
dpl float 32 type
Definition
dpl_types.h:67
math.h
Math helper macros.
os_types.h
mynewt-core types
os_time_t
uint32_t os_time_t
time type
Definition
os_types.h:48
os_stack_t
char os_stack_t
stack buffer type
Definition
os_types.h:53
Generated on Sat Nov 16 2024 15:21:13 by
1.9.8