mb/google/brya: Create rull variant
[coreboot2.git] / src / include / stdint.h
blobffe059dd63bba6a5ec75ff8be6d50e23132190e8
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef STDINT_H
4 #define STDINT_H
6 /* Fixed width integer types */
7 typedef signed char int8_t;
8 typedef unsigned char uint8_t;
10 typedef signed short int16_t;
11 typedef unsigned short uint16_t;
13 typedef signed int int32_t;
14 typedef unsigned int uint32_t;
16 typedef signed long long int64_t;
17 typedef unsigned long long uint64_t;
19 /* Types for 'void *' pointers */
20 typedef signed long intptr_t;
21 typedef unsigned long uintptr_t;
23 /* Ensure that the widths are all correct */
24 _Static_assert(sizeof(int8_t) == 1, "Size of int8_t is incorrect");
25 _Static_assert(sizeof(uint8_t) == 1, "Size of uint8_t is incorrect");
27 _Static_assert(sizeof(int16_t) == 2, "Size of int16_t is incorrect");
28 _Static_assert(sizeof(uint16_t) == 2, "Size of uint16_t is incorrect");
30 _Static_assert(sizeof(int32_t) == 4, "Size of int32_t is incorrect");
31 _Static_assert(sizeof(uint32_t) == 4, "Size of uint32_t is incorrect");
33 _Static_assert(sizeof(int64_t) == 8, "Size of int64_t is incorrect");
34 _Static_assert(sizeof(uint64_t) == 8, "Size of uint64_t is incorrect");
36 _Static_assert(sizeof(intptr_t) == sizeof(void *), "Size of intptr_t is incorrect");
37 _Static_assert(sizeof(uintptr_t) == sizeof(void *), "Size of uintptr_t is incorrect");
39 /* Maximum width integer types */
40 typedef int64_t intmax_t;
41 typedef uint64_t uintmax_t;
43 /* Convenient typedefs */
44 typedef int8_t s8;
45 typedef uint8_t u8;
47 typedef int16_t s16;
48 typedef uint16_t u16;
50 typedef int32_t s32;
51 typedef uint32_t u32;
53 typedef int64_t s64;
54 typedef uint64_t u64;
56 /* Limits of integer types */
57 #define INT8_MIN ((int8_t)0x80)
58 #define INT8_MAX ((int8_t)0x7F)
59 #define UINT8_MAX ((uint8_t)0xFF)
61 #define INT16_MIN ((int16_t)0x8000)
62 #define INT16_MAX ((int16_t)0x7FFF)
63 #define UINT16_MAX ((uint16_t)0xFFFF)
65 #define INT32_MIN ((int32_t)0x80000000)
66 #define INT32_MAX ((int32_t)0x7FFFFFFF)
67 #define UINT32_MAX ((uint32_t)0xFFFFFFFF)
69 #define INT64_MIN ((int64_t)0x8000000000000000)
70 #define INT64_MAX ((int64_t)0x7FFFFFFFFFFFFFFF)
71 #define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFF)
73 #define INTMAX_MIN INT64_MIN
74 #define INTMAX_MAX INT64_MAX
75 #define UINTMAX_MAX UINT64_MAX
77 #endif /* STDINT_H */