aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2011-12-22 21:31:21 +0200
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>2011-12-22 21:35:19 +0200
commit285cc8d4d023ea858116b9e985667b44ef7e69cc (patch)
treef042d9adc48199e13adf4e73c5be536e30eb1532
parent611402938ec3658773f4d0073375ae60d9323727 (diff)
Fix big endian bugs
Now it seems to work correctly and provide performance ~0.58 khash/s per thread on Cell PPU.
-rw-r--r--scrypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/scrypt.c b/scrypt.c
index 3b80a81..8838257 100644
--- a/scrypt.c
+++ b/scrypt.c
@@ -684,7 +684,7 @@ int scanhash_scrypt(int thr_id, unsigned char *pdata, unsigned char *scratchbuf,
unsigned char tmp_hash[32];
uint32_t *nonce = (uint32_t *)(data + 64 + 12);
uint32_t n = 0;
- uint32_t Htarg = *(uint32_t *)(ptarget + 28);
+ uint32_t Htarg = le32dec(ptarget + 28);
int i;
work_restart[thr_id].restart = 0;
@@ -694,11 +694,11 @@ int scanhash_scrypt(int thr_id, unsigned char *pdata, unsigned char *scratchbuf,
while(1) {
n++;
- *nonce = n;
+ le32enc(nonce, n);
scrypt_1024_1_1_256_sp(data, tmp_hash, scratchbuf);
- if (*(uint32_t *)(tmp_hash+28) <= Htarg) {
- *(uint32_t *)(pdata + 64 + 12) = swab32(n);
+ if (le32dec(tmp_hash+28) <= Htarg) {
+ be32enc(pdata + 64 + 12, n);
*hashes_done = n;
return true;
}