param_set: handle when the stack variable was modified better
[smatch.git] / target.h
blob8326fa21a47eb723f3268196c00ecd364e2fca2b
1 #ifndef TARGET_H
2 #define TARGET_H
4 extern struct symbol *size_t_ctype;
5 extern struct symbol *ssize_t_ctype;
7 /*
8 * For "__attribute__((aligned))"
9 */
10 extern int max_alignment;
13 * Integer data types
15 extern int bits_in_bool;
16 extern int bits_in_char;
17 extern int bits_in_short;
18 extern int bits_in_int;
19 extern int bits_in_long;
20 extern int bits_in_longlong;
21 extern int bits_in_longlonglong;
23 extern int bits_in_wchar;
25 extern int max_int_alignment;
28 * Floating point data types
30 extern int bits_in_float;
31 extern int bits_in_double;
32 extern int bits_in_longdouble;
34 extern int max_fp_alignment;
37 * Pointer data type
39 extern int bits_in_pointer;
40 extern int pointer_alignment;
43 * Enum data types
45 extern int bits_in_enum;
46 extern int enum_alignment;
49 * Helper functions for converting bits to bytes and vice versa.
52 static inline int bits_to_bytes(int bits)
54 return bits >= 0 ? (bits + bits_in_char - 1) / bits_in_char : -1;
57 static inline int bytes_to_bits(int bytes)
59 return bytes * bits_in_char;
62 static inline unsigned long array_element_offset(unsigned long base_bits, int idx)
64 int fragment = base_bits % bits_in_char;
65 if (fragment)
66 base_bits += bits_in_char - fragment;
67 return base_bits * idx;
70 #endif