aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2010-12-26 23:37:58 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-12-26 23:37:58 -0500
commit970e74c07d194d2eeba55874ed9ba9b7492b64cf (patch)
tree0d0e9c1b5e2a85a9eda7574082e06285932a7daa
parentae4cc6fc392e375d8b7c1d9e722bf5163afe42cc (diff)
Move 32-bit swap code into miner.h, for sharing.
-rw-r--r--miner.h11
-rw-r--r--sha256_via.c11
2 files changed, 11 insertions, 11 deletions
diff --git a/miner.h b/miner.h
index fc0fe5a..7979dc0 100644
--- a/miner.h
+++ b/miner.h
@@ -22,6 +22,17 @@
#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);
+}
+
extern bool opt_debug;
extern bool opt_protocol;
extern const uint32_t sha256_init_state[];
diff --git a/sha256_via.c b/sha256_via.c
index b4e2b91..6b85e2a 100644
--- a/sha256_via.c
+++ b/sha256_via.c
@@ -8,17 +8,6 @@
#ifdef WANT_VIA_PADLOCK
-#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);
-}
-
static void via_sha256(void *hash, void *buf, unsigned len)
{
unsigned stat = 0;