X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Ftypes.h;h=e838e7fc2a01aebde625c35aa84c95c86b44160c;hb=62458ef728064652932d49fbab1116b2f2462fa8;hp=65c141896b131e6e84f7bfb24d643a5816c29784;hpb=19ce03addb8071555d951a965fa0bd7e3ae7224b;p=wimlib diff --git a/include/wimlib/types.h b/include/wimlib/types.h index 65c14189..e838e7fc 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; @@ -21,23 +22,20 @@ typedef int32_t s32; typedef int64_t s64; /* Unsigned little endian types of exact size */ -typedef uint8_t le8; -typedef uint16_t le16; -typedef uint32_t le32; -typedef uint64_t le64; +typedef uint16_t _bitwise_attr le16; +typedef uint32_t _bitwise_attr le32; +typedef uint64_t _bitwise_attr le64; /* Signed little endian types of exact size (declare as unsigned to avoid sign * extension on big-endian architectures) */ -typedef uint8_t sle8; -typedef uint16_t sle16; -typedef uint32_t sle32; -typedef uint64_t sle64; +typedef uint16_t _bitwise_attr sle16; +typedef uint32_t _bitwise_attr sle32; +typedef uint64_t _bitwise_attr sle64; /* Unsigned big endian types of exact size */ -typedef uint8_t be8; -typedef uint16_t be16; -typedef uint32_t be32; -typedef uint64_t be64; +typedef uint16_t _bitwise_attr be16; +typedef uint32_t _bitwise_attr be32; +typedef uint64_t _bitwise_attr be64; #endif @@ -49,4 +47,13 @@ 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 */