From 42484fbcc4183a4e93f278105eade2dbcf353842 Mon Sep 17 00:00:00 2001 From: darealshinji Date: Fri, 12 Jul 2024 19:22:21 +0200 Subject: [PATCH 1/2] Try to correctly guess a 64 bit target --- incbin.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/incbin.h b/incbin.h index 3f662e1..27c5882 100644 --- a/incbin.h +++ b/incbin.h @@ -8,6 +8,16 @@ */ #ifndef INCBIN_HDR #define INCBIN_HDR + +#ifndef _MSC_VER +# include +# if defined(UINTPTR_MAX) && defined(UINT64_MAX) && !defined(__LP64__) +# if UINTPTR_MAX == UINT64_MAX +# define __LP64__ 1 +# endif +# endif +#endif + #include #if defined(__AVX512BW__) || \ defined(__AVX512CD__) || \ @@ -30,9 +40,11 @@ defined(__ARM_NEON) || \ defined(__ALTIVEC__) # define INCBIN_ALIGNMENT_INDEX 4 -#elif ULONG_MAX != 0xffffffffu +#elif defined(__LP64__) || \ + defined(_LP64) || \ + defined(_WIN64) # define INCBIN_ALIGNMENT_INDEX 3 -# else +#else # define INCBIN_ALIGNMENT_INDEX 2 #endif @@ -473,4 +485,4 @@ INCBIN_COMMON(char, NAME, FILENAME, INCBIN_BYTE "0\n") #endif -#endif \ No newline at end of file +#endif From 600e87e7d7dfccbc1ffa9a1d448a84cfa941056d Mon Sep 17 00:00:00 2001 From: darealshinji Date: Fri, 12 Jul 2024 19:25:17 +0200 Subject: [PATCH 2/2] don't exclude clang-cl from check --- incbin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incbin.h b/incbin.h index 27c5882..6a41a43 100644 --- a/incbin.h +++ b/incbin.h @@ -9,7 +9,7 @@ #ifndef INCBIN_HDR #define INCBIN_HDR -#ifndef _MSC_VER +#if !defined(_MSC_VER) || defined(__clang__) # include # if defined(UINTPTR_MAX) && defined(UINT64_MAX) && !defined(__LP64__) # if UINTPTR_MAX == UINT64_MAX