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


C++ CBigNum::getuint1024方法代码示例

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


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

示例1: GetThroughput

	void MinerThread::SK1024Miner()
	{
		SetThreadPriority(GetCurrentThread(), 2);
		const int throughput = GetThroughput() == 0 ? 512 * 1 * 512 * 8 : GetThroughput();
		loop
		{
			try
			{
				/** Don't mine if the Connection Thread is Submitting Block or Receiving New. **/
				while(m_bNewBlock || m_bBlockFound || !m_pBLOCK)
					Sleep(1);
		
				CBigNum target;
				target.SetCompact(m_pBLOCK->GetBits());				
				if (m_bBenchmark == true)
				{
					target.SetCompact(0x7e006fff);
					//target.SetCompact(0x7e7fffff);
					//target.SetCompact(0x7e7fffff);
					//target = target / 0x300;
				}

				while(!m_bNewBlock)
				{					
					
					uint1024 hash;
					unsigned long long hashes=0;
					unsigned int * TheData =(unsigned int*) m_pBLOCK->GetData();

					uint1024 TheTarget = target.getuint1024();
					uint64_t Nonce; //= m_pBLOCK->GetNonce();
					bool found = false;
					m_clLock.lock();
					{
						Nonce = m_pBLOCK->GetNonce();
						//m_GpuId = 0;
						found = scanhash_sk1024(m_GpuId, TheData, TheTarget, Nonce, 512 * 8 * 512 * 40, &hashes, throughput, 128, 128);
						if (hashes < 0xffffffffffff)
							SetHashes(GetHashes()+hashes);

					}
					m_clLock.unlock();
					
					if(found)
					{
						m_bBlockFound = true;
						m_clLock.lock();
						{
							m_pBLOCK->SetNonce(Nonce);
						}
						m_clLock.unlock();
                        						
                        break;
					}
 //                   printf("hashes %d m_unHashes %d gethashes %d\n",hashes,m_unHashes,GetHashes());
					/*m_clLock.lock();
					{
						m_pBLOCK->SetNonce(m_pBLOCK->GetNonce()+hashes); 
					}
					m_clLock.unlock();
*/

					if(Nonce >= MAX_THREADS) //max_thread==> max_nonce
					{
						m_bNewBlock = true;
						break;
					}
				}
				
			}
			catch(std::exception& e)
			{ 
				printf("ERROR: %s\n", e.what()); 
			}
		}
	}
开发者ID:hg5fm,项目名称:skminer,代码行数:76,代码来源:MinerThread.cpp


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