Post
Topic
Board Mining software (miners)
Re: New demonstration CPU miner available
by
SawEfDir
on 02/01/2011, 01:08:25 UTC
I've tried the following patch on a VIA Nano L2200 @ 1600 MHz on a Debian unstable amd64 system.

The speed increase is almost negligible. I've compiled minerd with using -O3, and with the patch, I'm getting really close to
1700kh/s. Without the patch, I'm getting about 1680. Using the builtin seems to gain 1% speed or so.

I've tried it on the testnet and got a good hash really quickly, so it seems to work ok.

Code:
diff --git a/miner.h b/miner.h
index 7979dc0..eda9498 100644
--- a/miner.h
+++ b/miner.h
@@ -22,15 +22,9 @@
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 
-#define ___constant_swab32(x) ((uint32_t)(                       \
-        (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) |            \
-        (((uint32_t)(x) & (uint32_t)0x0000ff00UL) <<  8) |            \
-        (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >>  8) |            \
-        (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
-
 static inline uint32_t swab32(uint32_t v)
 {
-       return ___constant_swab32(v);
+       return __builtin_bswap32(v);
 }
 
 extern bool opt_debug;