X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Ftypes.h;h=87f4604267cc94865d805847b7139f7747fc7c1c;hp=faf290c96f04c20d2937dbbe64cf6ca4e4039d40;hb=9538fd9ff3fb4a8e524b281ac6dc174e5d905ff6;hpb=e8c3ca2d1d0cac3d64985b45a9f654d2029a7518 diff --git a/include/wimlib/types.h b/include/wimlib/types.h index faf290c9..87f46042 100644 --- a/include/wimlib/types.h +++ b/include/wimlib/types.h @@ -1,12 +1,13 @@ #ifndef _WIMLIB_TYPES_H #define _WIMLIB_TYPES_H -#include "wimlib_tchar.h" - #include #include #include +#include "wimlib_tchar.h" +#include "wimlib/compiler.h" + #ifndef _NTFS_TYPES_H /* Unsigned integer types of exact size in bits */ typedef uint8_t u8; @@ -19,14 +20,33 @@ typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; + +/* Unsigned little endian types of exact size */ +typedef uint16_t _bitwise_attr le16; +typedef uint32_t _bitwise_attr le32; +typedef uint64_t _bitwise_attr le64; + +/* Unsigned big endian types of exact size */ +typedef uint16_t _bitwise_attr be16; +typedef uint32_t _bitwise_attr be32; +typedef uint64_t _bitwise_attr be64; #endif /* A pointer to 'utf16lechar' indicates a UTF-16LE encoded string */ -typedef u16 utf16lechar; +typedef le16 utf16lechar; #ifndef WIMLIB_WIMSTRUCT_DECLARED typedef struct WIMStruct WIMStruct; # define WIMLIB_WIMSTRUCT_DECLARED #endif -#endif +/* + * Type of a machine word. 'unsigned long' would be logical, but that is only + * 32 bits on x86_64 Windows. The same applies to 'uint_fast32_t'. So the best + * we can do without a bunch of #ifdefs appears to be 'size_t'. + */ +typedef size_t machine_word_t; + +#define WORDSIZE sizeof(machine_word_t) + +#endif /* _WIMLIB_TYPES_H */