Commit a8ccd24edac47b66b75092b0d65e207a2a43a67e

Con Kolivas 2012-11-24T13:23:53

Merge pull request #332 from nelisky/openwrt Openwrt tweaks

diff --git a/miner.h b/miner.h
index ba174a8..736f605 100644
--- a/miner.h
+++ b/miner.h
@@ -182,6 +182,12 @@ static inline int fsync (int fd)
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 
+#ifdef MIPSEB
+#ifndef roundl
+#define roundl(x)   (long double)((long long)((x==0)?0.0:((x)+((x)>0)?0.5:-0.5)))
+#endif
+#endif
+
 enum alive {
 	LIFE_WELL,
 	LIFE_SICK,
diff --git a/util.c b/util.c
index 3b07df4..a8e38cb 100644
--- a/util.c
+++ b/util.c
@@ -619,9 +619,13 @@ bool fulltest(const unsigned char *hash, const unsigned char *target)
 	swap256(target_swap, target);
 
 	for (i = 0; i < 32/4; i++) {
+#ifdef MIPSEB
+		uint32_t h32tmp = hash32[i];
+		uint32_t t32tmp = swab32(target32[i]);
+#else
 		uint32_t h32tmp = swab32(hash32[i]);
 		uint32_t t32tmp = target32[i];
-
+#endif
 		target32[i] = swab32(target32[i]);	/* for printing */
 
 		if (h32tmp > t32tmp) {