cgminer/patches/0001-work_decode-only-needs-swab32-on-midstate-under-BIG-.patch |
1 | | From 9414fa7c182eef279e4b21d3c3edeb11461af5bd Mon Sep 17 00:00:00 2001 |
2 | | From: Xiangfu <xiangfu@openmobilefree.net> |
3 | | Date: Fri, 11 May 2012 11:00:14 +0800 |
4 | | Subject: [PATCH 1/2] work_decode only needs swab32 on midstate under BIG |
5 | | ENDIAN |
6 | | |
7 | | cgminer.c | 17 +++++------------ |
8 | | 1 files changed, 5 insertions(+), 12 deletions(-) |
9 | | |
10 | | diff --git a/cgminer.c b/cgminer.c |
11 | | index 118747b..d8b8e6f 100644 |
12 | | +++ b/cgminer.c |
13 | | @@ -1182,6 +1182,11 @@ static bool work_decode(const json_t *val, struct work *work) |
14 | | sha2_starts( &ctx, 0 ); |
15 | | sha2_update( &ctx, data.c, 64 ); |
16 | | memcpy(work->midstate, ctx.state, sizeof(work->midstate)); |
17 | | +#if defined(__BIG_ENDIAN__) || defined(MIPSEB) |
18 | | + int i; |
19 | | + for (i = 0; i < 8; i++) |
20 | | + (((uint32_t*) (work->midstate))[i]) = swab32(((uint32_t*) (work->midstate))[i]); |
21 | | +#endif |
22 | | } |
23 | | |
24 | | if (likely(!jobj_binary(val, "hash1", work->hash1, sizeof(work->hash1), false))) { |
25 | | @@ -1196,18 +1201,6 @@ static bool work_decode(const json_t *val, struct work *work) |
26 | | |
27 | | memset(work->hash, 0, sizeof(work->hash)); |
28 | | |
29 | | -#ifdef __BIG_ENDIAN__ |
30 | | - int swapcounter = 0; |
31 | | - for (swapcounter = 0; swapcounter < 32; swapcounter++) |
32 | | - (((uint32_t*) (work->data))[swapcounter]) = swab32(((uint32_t*) (work->data))[swapcounter]); |
33 | | - for (swapcounter = 0; swapcounter < 16; swapcounter++) |
34 | | - (((uint32_t*) (work->hash1))[swapcounter]) = swab32(((uint32_t*) (work->hash1))[swapcounter]); |
35 | | - for (swapcounter = 0; swapcounter < 8; swapcounter++) |
36 | | - (((uint32_t*) (work->midstate))[swapcounter]) = swab32(((uint32_t*) (work->midstate))[swapcounter]); |
37 | | - for (swapcounter = 0; swapcounter < 8; swapcounter++) |
38 | | - (((uint32_t*) (work->target))[swapcounter]) = swab32(((uint32_t*) (work->target))[swapcounter]); |
39 | | -#endif |
40 | | - |
41 | | gettimeofday(&work->tv_staged, NULL); |
42 | | |
43 | | return true; |
44 | | 1.7.5.4 |
45 | | |
cgminer/patches/0002-add-MIPSEB-to-icarus-for-BIG_ENDIAN.patch |
1 | | From b1785d1f07d9482b5ed6104c87b39a3888fa8efb Mon Sep 17 00:00:00 2001 |
2 | | From: Xiangfu <xiangfu@openmobilefree.net> |
3 | | Date: Fri, 11 May 2012 11:04:28 +0800 |
4 | | Subject: [PATCH 2/2] add-MIPSEB-to-icarus-for-BIG_ENDIAN |
5 | | |
6 | | driver-icarus.c | 2 +- |
7 | | 1 files changed, 1 insertions(+), 1 deletions(-) |
8 | | |
9 | | diff --git a/driver-icarus.c b/driver-icarus.c |
10 | | index dba6617..5ef3300 100644 |
11 | | +++ b/driver-icarus.c |
12 | | @@ -350,7 +350,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work, |
13 | | return ESTIMATE_HASHES; |
14 | | } |
15 | | |
16 | | -#ifndef __BIG_ENDIAN__ |
17 | | +#if !defined (__BIG_ENDIAN__) && !defined(MIPSEB) |
18 | | nonce = swab32(nonce); |
19 | | #endif |
20 | | |
21 | | 1.7.5.4 |
22 | | |