summaryrefslogtreecommitdiff
path: root/builtin/stdint.h
blob: dedc9de475dc4c3f47cbca23d5fb4f0ad70bd997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_STDINT_H__
#define __CROS_EC_STDINT_H__

typedef unsigned char      uint8_t;
typedef signed char        int8_t;

typedef unsigned short     uint16_t;
typedef signed short       int16_t;

typedef unsigned int       uint32_t;
typedef signed int         int32_t;

typedef unsigned long long uint64_t;
typedef signed long long   int64_t;

typedef unsigned int       uintptr_t;
typedef int                intptr_t;

/* uint_leastX_t represents the smallest type available with at least X bits.
 * uint_fastX_t represents the fastest type available with at least X bits.
 */
typedef uint8_t            uint_least8_t;
typedef uint16_t           uint_least16_t;
typedef uint32_t           uint_least32_t;
typedef uint64_t           uint_least64_t;

typedef int8_t             int_least8_t;
typedef int16_t            int_least16_t;
typedef int32_t            int_least32_t;
typedef int64_t            int_least64_t;

typedef uint8_t            uint_fast8_t;
typedef uint16_t           uint_fast16_t;
typedef uint32_t           uint_fast32_t;
typedef uint64_t           uint_fast64_t;

typedef int8_t             int_fast8_t;
typedef int16_t            int_fast16_t;
typedef int32_t            int_fast32_t;
typedef int64_t            int_fast64_t;

#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127U)
#endif

#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767U)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32768)
#endif

#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647U)
#endif

#ifndef UINT64_C
#define UINT64_C(c)	c ## ULL
#endif
#ifndef INT64_C
#define INT64_C(c)	c ## LL
#endif

#ifndef UINT64_MAX
#define UINT64_MAX UINT64_C(18446744073709551615)
#endif
#ifndef INT64_MAX
#define INT64_MAX INT64_C(9223372036854775807)
#endif

#endif /* __CROS_EC_STDINT_H__ */