VSF Documented
type.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __APP_TYPE_H_INCLUDED__
19#define __APP_TYPE_H_INCLUDED__
20
21/*============================ INCLUDES ======================================*/
22
23#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(__cplusplus)
24typedef unsigned char uint8_t;
25typedef signed char int8_t;
26typedef unsigned char uint_fast8_t;
27typedef signed char int_fast8_t;
28
29typedef unsigned short uint16_t;
30typedef signed short int16_t;
31typedef unsigned short uint_fast16_t;
32typedef signed short int_fast16_t;
33
34typedef unsigned long int uint32_t;
35typedef signed long int int32_t;
36typedef unsigned long int uint_fast32_t;
37typedef signed long int int_fast32_t;
38
39typedef unsigned short uint_least16_t;
40typedef signed short int_least16_t
41
42typedef unsigned long int uint_least32_t;
43typedef signed long int int_least32_t
44
49
50#define INT8_MIN (-127i8 - 1)
51#define INT16_MIN (-32767i16 - 1)
52#define INT32_MIN (-2147483647i32 - 1)
53#define INT8_MAX 127i8
54#define INT16_MAX 32767i16
55#define INT32_MAX 2147483647i32
56#define UINT8_MAX 0xffui8
57#define UINT16_MAX 0xffffui16
58#define UINT32_MAX 0xffffffffui32
59
60#define INT_LEAST8_MIN INT8_MIN
61#define INT_LEAST16_MIN INT16_MIN
62#define INT_LEAST32_MIN INT32_MIN
63#define INT_LEAST8_MAX INT8_MAX
64#define INT_LEAST16_MAX INT16_MAX
65#define INT_LEAST32_MAX INT32_MAX
66#define UINT_LEAST8_MAX UINT8_MAX
67#define UINT_LEAST16_MAX UINT16_MAX
68#define UINT_LEAST32_MAX UINT32_MAX
69
70#define INT_FAST8_MIN INT8_MIN
71#define INT_FAST16_MIN INT32_MIN
72#define INT_FAST32_MIN INT32_MIN
73#define INT_FAST8_MAX INT8_MAX
74#define INT_FAST16_MAX INT32_MAX
75#define INT_FAST32_MAX INT32_MAX
76#define UINT_FAST8_MAX UINT8_MAX
77#define UINT_FAST16_MAX UINT32_MAX
78#define UINT_FAST32_MAX UINT32_MAX
79
80#define INTPTR_MIN INT32_MIN
81#define INTPTR_MAX INT32_MAX
82
83#define INTMAX_MIN INT32_MIN
84#define INTMAX_MAX INT32_MAX
85#define UINTMAX_MAX UINT32_MAX
86
87#define PTRDIFF_MIN INTPTR_MIN
88#define PTRDIFF_MAX INTPTR_MAX
89
90#define WCHAR_MIN 0x0000
91#define WCHAR_MAX 0xffff
92
93#ifndef SIZE_MAX
94 #define SIZE_MAX UINTPTR_MAX
95#endif
96
97#else
98# include <stdint.h>
99#endif
100
101#if !defined(__USE_LOCAL_STDBOOL__)
102# if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(__cplusplus)
103# if !defined(bool)
104typedef enum {
105 false = 0,
106 true = !false,
107} bool;
108# endif
109# else
110# include <stdbool.h>
111# endif
112#else
113# undef __USE_LOCAL_STDINT_STDBOOL__
114#endif
115
116#if !__IS_COMPILER_GCC__
117# include <uchar.h>
118#endif
119
120#ifdef __cplusplus
121extern "C" {
122#endif
123
124/*============================ MACROS ========================================*/
125
126#define __optimal_bit_sz (sizeof(uintalu_t) * 8)
127#define __optimal_bit_msk (__optimal_bit_sz - 1)
128
129/*============================ TYPE DEFINE ===================================*/
130
133
134/*============================ GLOBAL VARIABLES ==============================*/
135/*============================ LOCAL VARIABLES ===============================*/
136/*============================ PROTOTYPES ====================================*/
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif // __APP_TYPE_H_INCLUDED__
143
144
145/*============================ Multiple-Entry ================================*/
146#include "../__common/__type.h"
int64_t intmax_t
Definition type.h:52
uint32_t uintptr_t
Definition type.h:49
unsigned int uint_fast16_t
Definition type.h:32
signed short int16_t
Definition type.h:31
unsigned short uint16_t
Definition type.h:30
uint64_t uintmax_t
Definition type.h:51
signed int int_fast8_t
Definition type.h:28
unsigned int uint32_t
Definition type.h:35
int32_t intptr_t
Definition type.h:50
unsigned int uint_fast32_t
Definition type.h:37
signed int int_fast16_t
Definition type.h:33
signed int int32_t
Definition type.h:36
unsigned char uint8_t
Definition type.h:25
unsigned int uint_fast8_t
Definition type.h:27
signed int int_fast32_t
Definition type.h:38
signed char int8_t
Definition type.h:26
int32_t intalu_t
Definition type.h:69
uint32_t uintalu_t
Definition type.h:68
bool
Definition type.h:30
signed short int_least16_t typedef unsigned long int uint_least32_t
Definition type.h:42
unsigned short uint_least16_t
Definition type.h:39
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned uint32_t
Definition stdint.h:9
int int32_t
Definition stdint.h:8
int int_least32_t
Definition stdint.h:17
short int_least16_t
Definition stdint.h:15
char int_fast8_t
Definition stdint.h:22