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)
61 #ifndef CPU_IS_BIG_ENDIAN
62 # error "missing required endianness definition"
65 #define CPU_IS_LITTLE_ENDIAN (!CPU_IS_BIG_ENDIAN)
67 #ifndef UNALIGNED_ACCESS_SPEED
68 # define UNALIGNED_ACCESS_SPEED 0
71 #define UNALIGNED_ACCESS_IS_ALLOWED (UNALIGNED_ACCESS_SPEED >= 1)
72 #define UNALIGNED_ACCESS_IS_FAST (UNALIGNED_ACCESS_SPEED >= 2)
73 #define UNALIGNED_ACCESS_IS_VERY_FAST (UNALIGNED_ACCESS_SPEED >= 3)
76 # error "missing required definition of typeof"
79 #if !defined(min) || !defined(max) || !defined(swap)
80 # error "missing required definitions of min(), max(), and swap() macros"
84 # define _bitwise_attr __attribute__((bitwise))
85 # define _force_attr __attribute__((force))
87 # define _bitwise_attr
92 # define BUILD_BUG_ON(expr) ((void)sizeof(char[1 - 2*!!(expr)]))
95 #endif /* _WIMLIB_COMPILER_H */