这部分CryENGINE SDK标题引起了我的注意:
branchmask.h
#ifndef __BRANCHLESS_MASK__
#define __BRANCHLESS_MASK__
///////////////////////////////////////////
// helper functions for branch elimination
//
// msb/lsb - most/less significant byte
//
// mask - 0xFFFFFFFF
// nz - not zero
// zr - is zero
ILINE const uint32 nz2msb(const uint32 x)
{
return -(int32)x | x;
}
ILINE const uint32 msb2mask(const uint32 x)
{
return (int32)(x) >> 31;
}
ILINE const uint32 nz2one(const uint32 x)
{
return nz2msb(x) >> 31; // int((bool)x);
}
ILINE const uint32 nz2mask(const uint32 x) …Run Code Online (Sandbox Code Playgroud) 我试图编译cryengine 3的源代码,我总是得到以下错误信息.
Error 1 error : Required file "tracker.exe" is missing. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets 251 6 CryGame
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我无法在谷歌上找到任何信息.
可能我的Visual Studio安装有点腐败吗?我还在使用候选版本
只是一个简单的问题,谷歌搜索它不会导致任何(好的)结果:CryEngine 3可以在Java中使用吗?如果是这样,它会是一个好的选择吗?
目前我在jME3(jMonkey)尝试一些东西,它看起来做得很好,只是我认为CryEngine 3应该能够做得更多.
unsigned int HashString( const char *string ) {
const char* p;
unsigned hash = 40503;
for ( p = string; *p != '\0'; ++p ) {
hash += *p;
hash += ( hash << 10 );
hash ^= ( hash >> 6 );
}
hash += ( hash << 3 );
hash ^= ( hash >> 11 );
hash += ( hash << 15 );
return hash;
}
Run Code Online (Sandbox Code Playgroud)
只是徘徊在他们的代码上.虽然我以前从未见过像这样的散列函数.
当谈到按位运算时,我并不太专业,我知道位移和屏蔽是如何工作的,但只是在检查位是否设置的基本情况下.
这到底是做什么的?
看一下Qt Test Framework的一些宏QCOMPARE,这就是代码:
#define QCOMPARE(actual, expected) \
do {\
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
return;\
} while (0)
Run Code Online (Sandbox Code Playgroud)
如您所见,有一个while循环.我在CryEngine单元测试框架中也发现了同样的事情.我的问题很简单:是否有任何理由使用该循环或者可能是旧的实现留下的东西?