X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkernel_worker.cpp;h=2980952072963412684e182090ca352a8a7a11e1;hb=5b098a8ec26ef68b65dd42a04246418a871e9cd9;hp=4c5f2456ddb19bd860b723c2eea59f3769ab5fe5;hpb=ec14fee57c6757ebed907ac22c3172efb529f3b8;p=novacoin.git diff --git a/src/kernel_worker.cpp b/src/kernel_worker.cpp index 4c5f245..2980952 100644 --- a/src/kernel_worker.cpp +++ b/src/kernel_worker.cpp @@ -10,6 +10,11 @@ using namespace std; #ifdef USE_ASM +#ifdef _MSC_VER +#include +#define __builtin_bswap32 _byteswap_ulong +#endif + #if defined(__i386__) || defined(__x86_64__) #include #endif @@ -139,9 +144,15 @@ void KernelWorker::Do_8way() bnTargetPerCoinDay.SetCompact(nBits); uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(); +#ifdef _MSC_VER + __declspec(align(16)) uint32_t blocks1[8 * 16]; + __declspec(align(16)) uint32_t blocks2[8 * 16]; + __declspec(align(16)) uint32_t candidates[8 * 8]; +#else uint32_t blocks1[8 * 16] __attribute__((aligned(16))); uint32_t blocks2[8 * 16] __attribute__((aligned(16))); uint32_t candidates[8 * 8] __attribute__((aligned(16))); +#endif vector vRow = vector(8); uint32_t *pnKernel = (uint32_t *) kernel; @@ -210,9 +221,15 @@ void KernelWorker::Do_4way() bnTargetPerCoinDay.SetCompact(nBits); uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(); +#ifdef _MSC_VER + __declspec(align(16)) uint32_t blocks1[4 * 16]; + __declspec(align(16)) uint32_t blocks2[4 * 16]; + __declspec(align(16)) uint32_t candidates[4 * 8]; +#else uint32_t blocks1[4 * 16] __attribute__((aligned(16))); uint32_t blocks2[4 * 16] __attribute__((aligned(16))); uint32_t candidates[4 * 8] __attribute__((aligned(16))); +#endif vector vRow = vector(4); uint32_t *pnKernel = (uint32_t *) kernel; @@ -315,9 +332,16 @@ void KernelWorker::Do_generic() solutions.push_back(std::pair(*pnHashProofOfStake, nTimeTx)); } #else + +#ifdef _MSC_VER + __declspec(align(16)) uint32_t block1[16]; + __declspec(align(16)) uint32_t block2[16]; + __declspec(align(16)) uint32_t candidate[8]; +#else uint32_t block1[16] __attribute__((aligned(16))); uint32_t block2[16] __attribute__((aligned(16))); uint32_t candidate[8] __attribute__((aligned(16))); +#endif memcpy(&block1[7], &block1_suffix[0], 36); // sha256 padding memcpy(&block2[8], &block2_suffix[0], 32); @@ -390,7 +414,7 @@ vector >& KernelWorker::GetSolutions() #ifdef USE_ASM #ifdef __x86_64__ -bool ScanKernelBackward_8way(unsigned char *kernel, uint32_t nBits, uint32_t nInputTxTime, int64_t nValueIn, std::pair &SearchInterval, std::pair &solution) +bool ScanKernelBackward_8Way(unsigned char *kernel, uint32_t nBits, uint32_t nInputTxTime, int64_t nValueIn, std::pair &SearchInterval, std::pair &solution) { CBigNum bnTargetPerCoinDay; bnTargetPerCoinDay.SetCompact(nBits); @@ -400,9 +424,15 @@ bool ScanKernelBackward_8way(unsigned char *kernel, uint32_t nBits, uint32_t nIn // Get maximum possible target to filter out the majority of obviously insufficient hashes uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(); +#ifdef _MSC_VER + __declspec(align(16)) uint32_t blocks1[8 * 16]; + __declspec(align(16)) uint32_t blocks2[8 * 16]; + __declspec(align(16)) uint32_t candidates[8 * 8]; +#else uint32_t blocks1[8 * 16] __attribute__((aligned(16))); uint32_t blocks2[8 * 16] __attribute__((aligned(16))); uint32_t candidates[8 * 8] __attribute__((aligned(16))); +#endif vector vRow = vector(8); uint32_t *pnKernel = (uint32_t *) kernel; @@ -479,9 +509,15 @@ bool ScanKernelBackward_4Way(unsigned char *kernel, uint32_t nBits, uint32_t nIn // Get maximum possible target to filter out the majority of obviously insufficient hashes uint256 nMaxTarget = (bnTargetPerCoinDay * bnValueIn * nStakeMaxAge / COIN / nOneDay).getuint256(); +#ifdef _MSC_VER + __declspec(align(16)) uint32_t blocks1[4 * 16]; + __declspec(align(16)) uint32_t blocks2[4 * 16]; + __declspec(align(16)) uint32_t candidates[4 * 8]; +#else uint32_t blocks1[4 * 16] __attribute__((aligned(16))); uint32_t blocks2[4 * 16] __attribute__((aligned(16))); uint32_t candidates[4 * 8] __attribute__((aligned(16))); +#endif vector vRow = vector(4); uint32_t *pnKernel = (uint32_t *) kernel;