4 * The author dedicates this file to the public domain.
5 * You can do whatever you want with this file.
8 #ifndef _WIMLIB_COMPILER_H
9 #define _WIMLIB_COMPILER_H
12 # include "wimlib/compiler-gcc.h"
14 # error "Unrecognized compiler. Please add a header file for your compiler."
21 #ifndef _packed_attribute
22 # error "missing required definition of _packed_attribute"
25 #ifndef _aligned_attribute
26 # error "missing required definition of _aligned_attribute"
29 #ifndef _may_alias_attribute
30 # error "missing required definition of _may_alias_attribute"
34 # define likely(expr) (expr)
38 # define unlikely(expr) (expr)
42 # define prefetch(addr)
45 #ifndef _cold_attribute
46 # define _cold_attribute
49 #ifndef _malloc_attribute
50 # define _malloc_attribute
53 #ifndef _format_attribute
54 # define _format_attribute(type, format_str, format_start)
57 #ifndef CPU_IS_BIG_ENDIAN
58 # error "missing required definition of CPU_IS_BIG_ENDIAN"
61 #define CPU_IS_LITTLE_ENDIAN (!CPU_IS_BIG_ENDIAN)
63 #ifndef UNALIGNED_ACCESS_SPEED
64 # define UNALIGNED_ACCESS_SPEED 0
67 #define UNALIGNED_ACCESS_IS_ALLOWED (UNALIGNED_ACCESS_SPEED >= 1)
68 #define UNALIGNED_ACCESS_IS_FAST (UNALIGNED_ACCESS_SPEED >= 2)
69 #define UNALIGNED_ACCESS_IS_VERY_FAST (UNALIGNED_ACCESS_SPEED >= 3)
72 # error "missing required definition of typeof"
75 #if !defined(min) || !defined(max) || !defined(swap)
76 # error "missing required definitions of min(), max(), and swap() macros"
80 # define _bitwise_attr __attribute__((bitwise))
81 # define _force_attr __attribute__((force))
83 # define _bitwise_attr
88 # define BUILD_BUG_ON(expr) ((void)sizeof(char[1 - 2*!!(expr)]))
91 #endif /* _WIMLIB_COMPILER_H */