Skip to content

Commit 6ebb59d

Browse files
robUx4rhutsAMD
authored andcommitted
Define AMFPRI(d|ud|x)64 using the standard C++ format for C+11 and up
See https://en.cppreference.com/w/cpp/types/integer When compiled in C, it depends whether it's the Microsoft flavor or the standard C format. Not whether it's Win32 or not. Clang or GCC use the proper string formats on windows.
1 parent b927aa2 commit 6ebb59d

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

amf/public/include/core/Platform.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ typedef signed int HRESULT;
123123
#define AMF_FORCEINLINE __forceinline
124124
#endif
125125

126-
#define AMFPRId64 "I64d"
127-
128-
#define AMFPRIud64 "Iu64d"
129-
130-
#define AMFPRIx64 "I64x"
131-
132126
#else // !WIN32 - Linux and Mac
133127

134128
#define AMF_STD_CALL
@@ -142,24 +136,32 @@ typedef signed int HRESULT;
142136
#define AMF_FORCEINLINE __inline__
143137
#endif
144138

145-
#if defined(__x86_64__) || defined(__aarch64__)
146-
#define AMFPRId64 "ld"
147-
#define LPRId64 L"ld"
139+
#endif // WIN32
148140

149-
#define AMFPRIud64 "uld"
150-
#define LPRIud64 L"uld"
141+
#if defined(__cplusplus) && (__cplusplus >= 201103L)
142+
#include <cinttypes>
143+
#define AMFPRId64 PRId64
151144

152-
#define AMFPRIx64 "lx"
153-
#define LPRIx64 L"lx"
154-
#else
145+
#define AMFPRIud64 PRIu64
146+
147+
#define AMFPRIx64 PRIx64
148+
#else
149+
#if defined(_MSC_VER)
150+
#define AMFPRId64 "I64d"
151+
152+
#define AMFPRIud64 "Iu64d"
153+
154+
#define AMFPRIx64 "I64x"
155+
#else
156+
#if !defined(AMFPRId64)
155157
#define AMFPRId64 "lld"
156158

157-
#define AMFPRIud64 "ulld"
159+
#define AMFPRIud64 "ulld"
158160

159161
#define AMFPRIx64 "llx"
160162
#endif
161-
162-
#endif // WIN32
163+
#endif
164+
#endif
163165

164166
#define LPRId64 AMF_UNICODE(AMFPRId64)
165167
#define LPRIud64 AMF_UNICODE(AMFPRIud64)

0 commit comments

Comments
 (0)