/ src / include / types.h
types.h
 1  /* SPDX-License-Identifier: GPL-2.0-only */
 2  
 3  #ifndef __TYPES_H
 4  #define __TYPES_H
 5  
 6  /* types.h is supposed to provide the standard headers defined in here: */
 7  /* IWYU pragma: begin_exports */
 8  #include <commonlib/bsd/cb_err.h>
 9  #include <limits.h>
10  #include <stdbool.h>
11  #include <stdint.h>
12  #include <stddef.h>
13  /* IWYU pragma: end_exports */
14  
15  /*
16   * This may mean something else on architectures where the bits are numbered
17   * from the MSB (e.g. PowerPC), but until we cross that bridge, this macro is
18   * perfectly fine.
19   */
20  #ifndef BIT
21  #define BIT(x)				(1ul << (x))
22  #endif
23  
24  /*
25   * This macro declares a bit as a 32-bits unsigned integer. The common BIT_32(x)
26   * macro is already used by some external header file. To avoid any conflicts, we
27   * use a different name.
28   */
29  #ifndef BIT_FLAG_32
30  #define BIT_FLAG_32(x)			(1u << (x))
31  #endif
32  
33  #define BITS_PER_BYTE			8
34  
35  #endif /* __TYPES_H */