Re: tcatmの4-way SSE2(Linux 32/64ビット対応)が0.3.10に搭載

参加者: tcatm

ソースコードをレビューした。さらに最適化するアイデアがいくつかあり、4wayが部分的に壊れていることに気づいた:

main.cppより: Code: for (int j = 0; j < NPAR; j++) { if (thash[7][j] == 0) { for (int i = 0; i < sizeof(hash)/4; i++) ((unsigned int*)&hash)[i] = thash[i][j]; pblock->nNonce = ByteReverse(tmp.block.nNonce + j); } }

このコードは、正しいものである可能性のある32個のハッシュのうち、1つ(thash[7] == 0の最後のもの)しか処理しない。

こんな感じで修正できるはずだが、より高い難易度では安全ではないだろう。また、バイト順序を反転すべきかどうかもわからない。誰かレビューしてくれないか? Code: unsigned int min_hash = ~1; for (int j = 0; j < NPAR; j++) { if (thash[7][j] == 0) { if(thash[6][j] < min_hash) { min_hash = thash[6][j]; for (int i = 0; i < sizeof(hash)/4; i++) ((unsigned int*)&hash)[i] = thash[i][j]; pblock->nNonce = ByteReverse(tmp.block.nNonce + j); } } }