本文整理汇总了C++中CUInt128::Get32BitChunk方法的典型用法代码示例。如果您正苦于以下问题:C++ CUInt128::Get32BitChunk方法的具体用法?C++ CUInt128::Get32BitChunk怎么用?C++ CUInt128::Get32BitChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUInt128
的用法示例。
在下文中一共展示了CUInt128::Get32BitChunk方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StatsAddClosestDistance
void CKademlia::StatsAddClosestDistance(CUInt128 uDist){
if (uDist.Get32BitChunk(0) > 0){
uint32_t nToAdd = (0xFFFFFFFF / uDist.Get32BitChunk(0)) / 2;
if (m_liStatsEstUsersProbes.Find(nToAdd) == NULL)
m_liStatsEstUsersProbes.AddHead(nToAdd);
}
if (m_liStatsEstUsersProbes.GetCount() > 100)
m_liStatsEstUsersProbes.RemoveTail();
}
示例2: StatsAddClosestDistance
void CKademlia::StatsAddClosestDistance(const CUInt128& distance)
{
if (distance.Get32BitChunk(0) > 0) {
uint32_t toAdd = (0xFFFFFFFF / distance.Get32BitChunk(0)) / 2;
std::list<uint32_t>::iterator it = m_statsEstUsersProbes.begin();
for (; it != m_statsEstUsersProbes.end(); ++it) {
if (*it == toAdd) {
break;
}
}
if (it == m_statsEstUsersProbes.end()) {
m_statsEstUsersProbes.push_front(toAdd);
}
}
if (m_statsEstUsersProbes.size() > 100) {
m_statsEstUsersProbes.pop_back();
}
}
示例3: OnPaint
//.........这里部分代码省略.........
// Set the scaling. 3 times the highest distance of the 1/3 closest nodes is the max distance
CArray<CUInt128> aClosest;
for (int i = 1; i <= iVisibleNodes; i++)
{
if (aClosest.GetCount() < ((iVisibleNodes / 3 == 0) ? 1 : (iVisibleNodes / 3)))
aClosest.Add(m_pLookupHistory->GetHistoryEntries()[m_pLookupHistory->GetHistoryEntries().GetCount() - i]->m_uDistance);
else
{
int iReplace = -1;
for (int j = 0; j < aClosest.GetCount(); j++)
{
if ((iReplace == (-1) && aClosest[j] > m_pLookupHistory->GetHistoryEntries()[m_pLookupHistory->GetHistoryEntries().GetCount() - i]->m_uDistance)
|| (iReplace >= 0 && aClosest[j] > aClosest[iReplace]))
{
iReplace = j;
}
}
if (iReplace >= 0)
aClosest[iReplace] = m_pLookupHistory->GetHistoryEntries()[m_pLookupHistory->GetHistoryEntries().GetCount() - i]->m_uDistance;
}
}
CUInt128 uTmpScalingDistance((ULONG)0);
for (int j = 0; j < aClosest.GetCount(); j++)
{
if (aClosest[j] > uTmpScalingDistance)
uTmpScalingDistance = aClosest[j];
}
// Convert it to uint64 by cutting of the less significant bits for easier and fast calculating
uint64 uScalingDistance = 0;
uint8 byStartChunk;
for (byStartChunk = 0; byStartChunk < 3; byStartChunk++)
{
if (uTmpScalingDistance.Get32BitChunk(byStartChunk) > 0)
{
uScalingDistance = ((uint64)uTmpScalingDistance.Get32BitChunk(byStartChunk) << 32) + (uint64)uTmpScalingDistance.Get32BitChunk(byStartChunk + 1);
break;
}
}
if (uScalingDistance == 0)
{
byStartChunk = 2;
uScalingDistance = uTmpScalingDistance.Get32BitChunk(3);
}
uScalingDistance /= (uHistHeight - NODE_ENTRY_HEIGHT);
uScalingDistance *= 3;
ASSERT(uScalingDistance > 0);
if (uScalingDistance == 0)
uScalingDistance = 1;
//if (m_bDbgLog)
// AddDebugLogLine(false, _T("KadGraph: Considering %u of %u Nodes, 1/3 Max Distance found: %s"), iVisibleNodes, m_pLookupHistory->GetHistoryEntries().GetCount(), uTmpScalingDistance.ToHexString());
CUInt128 uMaxScalingDistance(uTmpScalingDistance);
uMaxScalingDistance.Add(uTmpScalingDistance);
uMaxScalingDistance.Add(uTmpScalingDistance);
// wow, what a mess, now lets collect drawing points
for (int i = 1; i <= iVisibleNodes; i++)
{
CUInt128 uTmpDist = m_pLookupHistory->GetHistoryEntries()[m_pLookupHistory->GetHistoryEntries().GetCount() - i]->m_uDistance;
uint64 uDrawYPos;
if (uTmpDist > uMaxScalingDistance)
uDrawYPos = iTopBorder;
else