48 lines
911 B
C
48 lines
911 B
C
/**
|
|
* @file dl_platform.h
|
|
* @brief 平台宏
|
|
*
|
|
* @version 1.0
|
|
* @author lveyou
|
|
* @date 23-06-23
|
|
*
|
|
* @note 必须使用 DL_PLATFORM == DL_PLATFORM_WIN32
|
|
来判断,避免未包含头文件引起误判
|
|
*/
|
|
#pragma once
|
|
|
|
#define DL_PLATFORM_ERROR 0
|
|
#define DL_PLATFORM_WIN32 1
|
|
#define DL_PLATFORM_LINUX 2
|
|
#define DL_PLATFORM_ANDROID 3
|
|
|
|
#define DL_PLATFORM DL_PLATFORM_ERROR
|
|
|
|
#ifdef _WIN32
|
|
#undef DL_PLATFORM
|
|
#define DL_PLATFORM DL_PLATFORM_WIN32
|
|
#endif
|
|
|
|
#ifdef __linux__
|
|
#undef DL_PLATFORM
|
|
#define DL_PLATFORM DL_PLATFORM_LINUX
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
#undef DL_PLATFORM
|
|
#define DL_PLATFORM DL_PLATFORM_ANDROID
|
|
#endif
|
|
|
|
//! 是否64位
|
|
consteval bool is_x64()
|
|
{
|
|
return sizeof(void*) == 8;
|
|
}
|
|
|
|
#if defined(__LP64__) || defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64)
|
|
#ifndef DL_X64
|
|
#define DL_X64
|
|
#endif
|
|
#endif
|
|
|
|
#define DL_ENDIAN_LITTLE can-not-use |