Browse Source

Merge pull request #332 from nelisky/openwrt

Openwrt tweaks
Con Kolivas 13 years ago
parent
commit
a8ccd24eda
2 changed files with 11 additions and 1 deletions
  1. 6 0
      miner.h
  2. 5 1
      util.c

+ 6 - 0
miner.h

@@ -182,6 +182,12 @@ static inline int fsync (int fd)
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 #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 {
 enum alive {
 	LIFE_WELL,
 	LIFE_WELL,
 	LIFE_SICK,
 	LIFE_SICK,

+ 5 - 1
util.c

@@ -619,9 +619,13 @@ bool fulltest(const unsigned char *hash, const unsigned char *target)
 	swap256(target_swap, target);
 	swap256(target_swap, target);
 
 
 	for (i = 0; i < 32/4; i++) {
 	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 h32tmp = swab32(hash32[i]);
 		uint32_t t32tmp = target32[i];
 		uint32_t t32tmp = target32[i];
-
+#endif
 		target32[i] = swab32(target32[i]);	/* for printing */
 		target32[i] = swab32(target32[i]);	/* for printing */
 
 
 		if (h32tmp > t32tmp) {
 		if (h32tmp > t32tmp) {