-typedef unsigned char byte;
-typedef char u8;
-typedef unsigned short word;
-typedef short u16;
-typedef unsigned long u32;
+/* On Windows compilers, use <windows.h> */
+#include <windows.h>
+typedef BYTE u8;
+typedef WORD u16;
+typedef DWORD u32;
+typedef unsigned __int64 u64;
+#define PCI_U64_FMT_X "I64x"
+#define PCI_U64_FMT_U "I64u"
+
+#elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+/* Use standard types in C99 and newer */
+#include <stdint.h>
+#include <inttypes.h>
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+#define PCI_U64_FMT_X PRIx64
+#define PCI_U64_FMT_U PRIu64
+