]> wimlib.net Git - wimlib/blob - include/wimlib/types.h
Improve random number generation
[wimlib] / include / wimlib / types.h
1 #ifndef _WIMLIB_TYPES_H
2 #define _WIMLIB_TYPES_H
3
4 #include <inttypes.h>
5 #include <stdbool.h>
6 #include <stddef.h>
7
8 #include "wimlib_tchar.h"
9 #include "wimlib/compiler.h"
10
11 #ifndef _NTFS_TYPES_H
12 /* Unsigned integer types of exact size in bits */
13 typedef uint8_t  u8;
14 typedef uint16_t u16;
15 typedef uint32_t u32;
16 typedef uint64_t u64;
17
18 /* Signed integer types of exact size in bits */
19 typedef int8_t  s8;
20 typedef int16_t s16;
21 typedef int32_t s32;
22 typedef int64_t s64;
23
24 /* Unsigned little endian types of exact size */
25 typedef uint16_t _bitwise_attr le16;
26 typedef uint32_t _bitwise_attr le32;
27 typedef uint64_t _bitwise_attr le64;
28
29 /* Unsigned big endian types of exact size */
30 typedef uint16_t _bitwise_attr be16;
31 typedef uint32_t _bitwise_attr be32;
32 typedef uint64_t _bitwise_attr be64;
33 #endif
34
35 /* A pointer to 'utf16lechar' indicates a UTF-16LE encoded string */
36 typedef le16 utf16lechar;
37
38 #ifndef WIMLIB_WIMSTRUCT_DECLARED
39 typedef struct WIMStruct WIMStruct;
40 #  define WIMLIB_WIMSTRUCT_DECLARED
41 #endif
42
43 /*
44  * Type of a machine word.  'unsigned long' would be logical, but that is only
45  * 32 bits on x86_64 Windows.  The same applies to 'uint_fast32_t'.  So the best
46  * we can do without a bunch of #ifdefs appears to be 'size_t'.
47  */
48 typedef size_t machine_word_t;
49
50 #define WORDBYTES       sizeof(machine_word_t)
51 #define WORDBITS        (8 * WORDBYTES)
52
53 #endif /* _WIMLIB_TYPES_H */