Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _TYPES_H_
0003 #define _TYPES_H_
0004 
0005 #include <stdbool.h>
0006 
0007 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
0008 
0009 typedef unsigned char       u8;
0010 typedef unsigned short      u16;
0011 typedef unsigned int        u32;
0012 typedef unsigned long long  u64;
0013 typedef signed char     s8;
0014 typedef short           s16;
0015 typedef int         s32;
0016 typedef long long       s64;
0017 
0018 /* required for opal-api.h */
0019 typedef u8  uint8_t;
0020 typedef u16 uint16_t;
0021 typedef u32 uint32_t;
0022 typedef u64 uint64_t;
0023 typedef s8  int8_t;
0024 typedef s16 int16_t;
0025 typedef s32 int32_t;
0026 typedef s64 int64_t;
0027 
0028 #define min(x,y) ({ \
0029     typeof(x) _x = (x); \
0030     typeof(y) _y = (y); \
0031     (void) (&_x == &_y);    \
0032     _x < _y ? _x : _y; })
0033 
0034 #define max(x,y) ({ \
0035     typeof(x) _x = (x); \
0036     typeof(y) _y = (y); \
0037     (void) (&_x == &_y);    \
0038     _x > _y ? _x : _y; })
0039 
0040 #define min_t(type, a, b) min(((type) a), ((type) b))
0041 #define max_t(type, a, b) max(((type) a), ((type) b))
0042 
0043 typedef int bool;
0044 
0045 #ifndef true
0046 #define true 1
0047 #endif
0048 
0049 #ifndef false
0050 #define false 0
0051 #endif
0052 #endif /* _TYPES_H_ */