本文整理汇总了C++中Header::GetRankKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Header::GetRankKey方法的具体用法?C++ Header::GetRankKey怎么用?C++ Header::GetRankKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Header
的用法示例。
在下文中一共展示了Header::GetRankKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetKey
unsigned Hash::GetKey(
const Header& header)
{
// TRICK: 12 bits (4096) --> 132 combinations, 8 bits.
int tFullTrick = header.GetTrickKey();
int tRedTrick;
if (trickKeyMap[tFullTrick] == 0)
trickKeyMap[tFullTrick] = keyMapNo++;
tRedTrick = trickKeyMap[tFullTrick]-1;
assert(tFullTrick < SDS_HASH_LENTRICK);
assert(tRedTrick < 250);
// RANK: 12 bits ( 4096) --> 399 combinations, 9 bits.
// RANK: 16 bits (65536) --> 593 combinations, 10 bits.
int tFullRank = header.GetRankKey();
int tRedRank;
if (rankKeyMap[tFullRank] == 0)
rankKeyMap[tFullRank] = rankMapNo++;
tRedRank = rankKeyMap[tFullRank]-1;
assert(tFullRank < SDS_HASH_LENRANK);
assert(tRedRank < 1000);
// CASE: ? bits --> 20 combinations, 5 bits.
unsigned tFullCase = header.GetKeyNew();
int tRedCase;
if (caseKeyMap[tFullCase] == 0)
caseKeyMap[tFullCase] = caseMapNo++;
tRedCase = caseKeyMap[tFullCase]-1;
assert(tFullCase < SDS_HASH_LENCASE);
assert(tRedCase < 128);
int tFullRankCase = (tRedRank << 7) | tRedCase;
int tRedRankCase;
if (rankCaseKeyMap[tFullRankCase] == 0)
rankCaseKeyMap[tFullRankCase] = rankCaseMapNo++;
tRedRankCase = rankCaseKeyMap[tFullRankCase]-1;
assert(tFullRankCase < SDS_HASH_LENRANKCASE);
assert(tRedRankCase < 4096);
int key = (tRedRankCase << 8) | tRedTrick;
assert(key < ML_MAXKEY);
return key;
}