Root/cgminer/patches/0001-add-MIPSED-to-icarus-for-BIG_ENDIAN.patch.patch

1From 1a19591a7f4cfa873f2c6fe58b48d7588187e4c7 Mon Sep 17 00:00:00 2001
2From: Xiangfu <xiangfu@openmobilefree.net>
3Date: Sun, 19 Feb 2012 22:20:22 +0800
4Subject: [PATCH] add-MIPSED-to-icarus-for-BIG_ENDIAN.patch
5
6---
7 cgminer.c | 4 ++--
8 icarus.c | 2 +-
9 uthash.h | 2 +-
10 3 files changed, 4 insertions(+), 4 deletions(-)
11
12diff --git a/cgminer.c b/cgminer.c
13index cfb0216..2976092 100644
14--- a/cgminer.c
15+++ b/cgminer.c
16@@ -1102,7 +1102,7 @@ static bool work_decode(const json_t *val, struct work *work)
17 
18     memset(work->hash, 0, sizeof(work->hash));
19 
20-#ifdef __BIG_ENDIAN__
21+#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
22         int swapcounter = 0;
23         for (swapcounter = 0; swapcounter < 32; swapcounter++)
24             (((uint32_t*) (work->data))[swapcounter]) = swab32(((uint32_t*) (work->data))[swapcounter]);
25@@ -1479,7 +1479,7 @@ static bool submit_upstream_work(const struct work *work)
26         return rc;
27     }
28 
29-#ifdef __BIG_ENDIAN__
30+#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
31         int swapcounter = 0;
32         for (swapcounter = 0; swapcounter < 32; swapcounter++)
33             (((uint32_t*) (work->data))[swapcounter]) = swab32(((uint32_t*) (work->data))[swapcounter]);
34diff --git a/icarus.c b/icarus.c
35index 276cd8c..0ad7398 100644
36--- a/icarus.c
37+++ b/icarus.c
38@@ -294,7 +294,7 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
39         if (nonce == 0 && ret)
40                 return 0xffffffff;
41 
42-#ifndef __BIG_ENDIAN__
43+#if !defined (__BIG_ENDIAN__) && !defined(MIPSEB)
44     nonce = swab32(nonce);
45 #endif
46     work->blk.nonce = 0xffffffff;
47diff --git a/uthash.h b/uthash.h
48index 4cedb9c..f55fc77 100644
49--- a/uthash.h
50+++ b/uthash.h
51@@ -500,7 +500,7 @@ do {
52 #define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 0x3) == 2)
53 #define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 0x3) == 3)
54 #define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL))
55-#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__))
56+#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) || defined(MIPSEB)
57 #define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24))
58 #define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16))
59 #define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8))
60--
611.7.5.4
62
63

Archive Download this file



interactive