// 参考:
// "编译器中和64位编程有关的预定义宏"
// https://blog.youkuaiyun.com/liangbch/article/details/36020391
// 《Calling conventions for different C++ compilers and operating systems》,
// Last updated 2012-02-29,By Agner Fog. Copenhagen University College.
// # 查看内置宏:
// gcc -dM -E - < /dev/null
// # 查看系统位数
// getconf LONG_BIT
//******************************************************************************
// Automated Hardware Platform Detection
//******************************************************************************
#if defined(_M_IX86) || defined(__INTEL__) ||
defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
// x86 32bit
#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) ||
defined(__amd64) || defined(__amd64__)
// x86-64
#elif defined(__IA64__)
// IA64
#elif defined(__ALPHA__)
// DEC Alpha
#elif defined(__POWERPC__)
// Motorola Power PC
#elif defined(__LITTLE_ENDIAN__)
// Any other little endian
#elif defined(__BIG_ENDIAN__)
// Any other big endian
#endif
//******************************************************************************
// Automated Operating System Detection
//******************************************************************************
#if defined(__MSDOS__) || defined(_MSDOS)
// DOS 16 bit
#elif defined(_WIN16)
// Windows 16 bit
#elif defined(_WIN32) || defined(__WINDOWS__)
// define something for Windows (32-bit and 64-bit, this part is common)
#ifdef _WIN64
// define something for Windows (64-bit only)
#else
// define something for Windows (32-bit only)
#endif
#elif defined(__APPLE__) || defined(__DARWIN__) || defined(__MACH__)
// define something for Mac OS (32-bit and 64-bit, this part is common)
#if TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_IPHONE
// iOS Device
#elif TARGET_OS_MAC
// Other Kinds Of Mac OS
#endif
#elif defined(__ANDROID__)
// android
#elif defined(__BSD__) || defined(__FREEBSD__)
// BSD
#elif defined(__linux__)
// define something for linux (32-bit and 64-bit, this part is common)
// Linux Subsystem: Ubuntu, Solaris, Redhat, RHEL, CentOS, Fedora, Arch Linux,
// Debian, openSUSE, Flatpak, Solus*, FreeBSD*, 红旗Linux
#ifif defined(__LP64__) || defined(__amd64) //|| defined(__amd64__)
// define something for linux (64-bit only)
#else
// define something for linux (32-bit only)
#endif
#elif defined(__OS2__)
// OS/2
#elif defined(__unix__)// all unices not caught above
// Unix
#elif defined(_POSIX_VERSION)
// POSIX
#else
// KDE Neon, Windows ICE, Windows Phone, Windows Subsystem for Linux(简称WSL), HarmonyOS
#error "Unknown"
#endif
// Define __WIN16__ platform indicator
#ifdef _Windows_
#ifndef __NT__
#define __WIN16__
#endif
#endif
// _WIN32 is used by
// Visual C++
#ifdef _WIN32
#define __NT__
#endif
// Define __MAC__ platform indicator
#ifdef macintosh
#define __MAC__
#endif
// Define __OSX__ platform indicator
#ifdef __APPLE__
#define __OSX__
#endif
// Define Windows CE platform indicator
#ifdef WIN32_PLATFORM_HPCPRO
#define __WINCE__
#endif
#if (_WIN32_WCE == 300) // for Pocket PC
#define __POCKETPC__
#define __WINCE__
//#if (_WIN32_WCE == 211) // for Palm-size PC 2.11 (Wyvern)
//#if (_WIN32_WCE == 201) // for Palm-size PC 2.01 (Gryphon)
//#ifdef WIN32_PLATFORM_HPC2000 // for H/PC 2000 (Galileo)
#endif
//******************************************************************************
// Automated Windows System Version Detection
//*************************