7bea4231c417be0f347fc097d4919d207ebada18
[novacoin.git] / src / kernel_worker.h
1 #ifndef BITCOIN_HERNELWORKER_H
2 #define BITCOIN_HERNELWORKER_H
3
4 #include <vector>
5
6 using namespace std;
7
8 class KernelWorker
9 {
10 public:
11     KernelWorker()
12     { }
13     KernelWorker(unsigned char *kernel, uint32_t nBits, uint32_t nInputTxTime, int64_t nValueIn, uint32_t nIntervalBegin, uint32_t nIntervalEnd);
14     void Do();
15     vector<pair<uint256,uint32_t> >& GetSolutions();
16
17 private:
18 #ifdef USE_ASM
19 #ifdef __x86_64__
20     // AVX2 CPUs: 8-way hashing.
21     void Do_8way();
22 #endif
23     // SSE2, Neon: 4-way hashing.
24     void Do_4way();
25 #endif
26     // One way hashing.
27     void Do_generic();
28
29     // Kernel solutions.
30     vector<pair<uint256,uint32_t> > solutions;
31
32     // Kernel metadaya
33     uint8_t *kernel;
34     uint32_t nBits;
35     uint32_t nInputTxTime;
36     CBigNum  bnValueIn;
37
38     // Interval boundaries.
39     uint32_t nIntervalBegin;
40     uint32_t nIntervalEnd;
41 };
42
43 // Scan given kernel for solutions
44 bool ScanKernelBackward(unsigned char *kernel, uint32_t nBits, uint32_t nInputTxTime, int64_t nValueIn, pair<uint32_t, uint32_t> &SearchInterval, pair<uint256, uint32_t> &solution);
45
46 #endif