#ifndef INFINITY
#ifdef _MSC_VER
union MSVC_EVIL_FLOAT_HACK
{
unsigned __int8 Bytes[4];
float Value;
};
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
Run Code Online (Sandbox Code Playgroud)
我现在开始使用Chipmunk物理引擎,并在头文件中找到它
INFINITY用于为对象设置无限动量,但我不明白上面的代码是做什么的!
c++ ×1