xref: /openbmc/linux/arch/powerpc/boot/types.h (revision b2441318)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TYPES_H_
3 #define _TYPES_H_
4 
5 #include <stdbool.h>
6 
7 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
8 
9 typedef unsigned char		u8;
10 typedef unsigned short		u16;
11 typedef unsigned int		u32;
12 typedef unsigned long long	u64;
13 typedef signed char		s8;
14 typedef short			s16;
15 typedef int			s32;
16 typedef long long		s64;
17 
18 /* required for opal-api.h */
19 typedef u8  uint8_t;
20 typedef u16 uint16_t;
21 typedef u32 uint32_t;
22 typedef u64 uint64_t;
23 typedef s8  int8_t;
24 typedef s16 int16_t;
25 typedef s32 int32_t;
26 typedef s64 int64_t;
27 
28 #define min(x,y) ({ \
29 	typeof(x) _x = (x);	\
30 	typeof(y) _y = (y);	\
31 	(void) (&_x == &_y);	\
32 	_x < _y ? _x : _y; })
33 
34 #define max(x,y) ({ \
35 	typeof(x) _x = (x);	\
36 	typeof(y) _y = (y);	\
37 	(void) (&_x == &_y);	\
38 	_x > _y ? _x : _y; })
39 
40 #define min_t(type, a, b) min(((type) a), ((type) b))
41 #define max_t(type, a, b) max(((type) a), ((type) b))
42 
43 typedef int bool;
44 
45 #ifndef true
46 #define true 1
47 #endif
48 
49 #ifndef false
50 #define false 0
51 #endif
52 #endif /* _TYPES_H_ */
53