当前位置: 首页>>代码示例>>C++>>正文


C++ CUInt128::GetBitNumber方法代码示例

本文整理汇总了C++中CUInt128::GetBitNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ CUInt128::GetBitNumber方法的具体用法?C++ CUInt128::GetBitNumber怎么用?C++ CUInt128::GetBitNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUInt128的用法示例。


在下文中一共展示了CUInt128::GetBitNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: throw

CContact *CRoutingZone::GetContact(const CUInt128& id) const throw()
{
    if (IsLeaf()) {
        return m_bin->GetContact(id);
    } else {
        CUInt128 distance = CKademlia::GetPrefs()->GetKadID();
        distance ^= id;
        return m_subZones[distance.GetBitNumber(m_level)]->GetContact(id);
    }
}
开发者ID:supertanglang,项目名称:NeoLoader,代码行数:10,代码来源:RoutingZone.cpp

示例2:

CContact *CRoutingZone::GetContact(const CUInt128 &uID) const
{
	if (IsLeaf())
		return m_pBin->GetContact(uID);
	else{
		CUInt128 uDistance;
		CKademlia::GetPrefs()->GetKadID(&uDistance);
		uDistance.Xor(uID);
		return m_pSubZones[uDistance.GetBitNumber(m_uLevel)]->GetContact(uID);
	}
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:11,代码来源:RoutingZone.cpp

示例3:

CUInt128::CUInt128(const CUInt128 &uValue, UINT uNumBits)
{
	// Copy the whole ULONGs
	UINT uNumULONGs = uNumBits / 32;
	for (UINT iIndex=0; iIndex<uNumULONGs; iIndex++)
		m_uData[iIndex] = uValue.m_uData[iIndex];

	// Copy the remaining bits
	for (UINT iIndex=(32*uNumULONGs); iIndex<uNumBits; iIndex++)
		SetBitNumber(iIndex, uValue.GetBitNumber(iIndex));

	// Pad with random bytes (Not seeding based on time to allow multiple different ones to be created in quick succession)
	for (UINT iIndex=uNumBits; iIndex<128; iIndex++)
		SetBitNumber(iIndex, (rand()%2));
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:15,代码来源:UInt128.cpp

示例4: GetClosestTo

void CRoutingZone::GetClosestTo(uint32 uMaxType, const CUInt128 &uTarget, const CUInt128 &uDistance, uint32 uMaxRequired, ContactMap *pmapResult, bool bEmptyFirst, bool bInUse) const
{
	// If leaf zone, do it here
	if (IsLeaf())
	{
		m_pBin->GetClosestTo(uMaxType, uTarget, uMaxRequired, pmapResult, bEmptyFirst, bInUse);
		return;
	}

	// otherwise, recurse in the closer-to-the-target subzone first
	int iCloser = uDistance.GetBitNumber(m_uLevel);
	m_pSubZones[iCloser]->GetClosestTo(uMaxType, uTarget, uDistance, uMaxRequired, pmapResult, bEmptyFirst, bInUse);

	// if still not enough tokens found, recurse in the other subzone too
	if (pmapResult->size() < uMaxRequired)
		m_pSubZones[1-iCloser]->GetClosestTo(uMaxType, uTarget, uDistance, uMaxRequired, pmapResult, false, bInUse);
}
开发者ID:tempbottle,项目名称:TestSet,代码行数:17,代码来源:RoutingZone.cpp

示例5: GetClosestTo

void CRoutingZone::GetClosestTo(uint32_t maxType, const CUInt128& target, const CUInt128& distance, uint32_t maxRequired, ContactMap *result, bool emptyFirst, bool inUse) const
{
    // If leaf zone, do it here
    if (IsLeaf()) {
        m_bin->GetClosestTo(maxType, target, maxRequired, result, emptyFirst, inUse);
        return;
    }

    // otherwise, recurse in the closer-to-the-target subzone first
    int closer = distance.GetBitNumber(m_level);
    m_subZones[closer]->GetClosestTo(maxType, target, distance, maxRequired, result, emptyFirst, inUse);

    // if still not enough tokens found, recurse in the other subzone too
    if (result->size() < maxRequired) {
        m_subZones[1-closer]->GetClosestTo(maxType, target, distance, maxRequired, result, false, inUse);
    }
}
开发者ID:supertanglang,项目名称:NeoLoader,代码行数:17,代码来源:RoutingZone.cpp


注:本文中的CUInt128::GetBitNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。