From 4c0822a3134a56b1c61c3cc509f2f0e44aae7688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 10 Jun 2016 13:29:21 +0300 Subject: [PATCH] libethash: fix compilation on big endian systems (MIPS) --- src/libethash/endian.h | 29 ++++++++++++++--------------- src/libethash/internal.c | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/libethash/endian.h b/src/libethash/endian.h index 849325a5..5b8abf03 100644 --- a/src/libethash/endian.h +++ b/src/libethash/endian.h @@ -19,7 +19,7 @@ # define BYTE_ORDER LITTLE_ENDIAN #elif defined( __QNXNTO__ ) && defined( __BIGENDIAN__ ) # define BIG_ENDIAN 1234 - # define BYTE_ORDER BIG_ENDIAN + # define BYTE_ORDER BIG_ENDIAN #else # include #endif @@ -59,21 +59,20 @@ #define fix_endian32(dst_, src_) dst_ = ethash_swap_u32(src_) #define fix_endian32_same(val_) val_ = ethash_swap_u32(val_) -#define fix_endian64(dst_, src_) dst_ = ethash_swap_u64(src_ +#define fix_endian64(dst_, src_) dst_ = ethash_swap_u64(src_) #define fix_endian64_same(val_) val_ = ethash_swap_u64(val_) -#define fix_endian_arr32(arr_, size_) \ - do { \ - for (unsigned i_ = 0; i_ < (size_), ++i_) { \ - arr_[i_] = ethash_swap_u32(arr_[i_]); \ - } \ - while (0) -#define fix_endian_arr64(arr_, size_) \ - do { \ - for (unsigned i_ = 0; i_ < (size_), ++i_) { \ - arr_[i_] = ethash_swap_u64(arr_[i_]); \ - } \ - while (0) \ - +#define fix_endian_arr32(arr_, size_) \ + do { \ + for (unsigned i_ = 0; i_ < (size_); ++i_) { \ + arr_[i_] = ethash_swap_u32(arr_[i_]); \ + } \ + } while (0) +#define fix_endian_arr64(arr_, size_) \ + do { \ + for (unsigned i_ = 0; i_ < (size_); ++i_) { \ + arr_[i_] = ethash_swap_u64(arr_[i_]); \ + } \ + } while (0) #else # error "endian not supported" #endif // BYTE_ORDER diff --git a/src/libethash/internal.c b/src/libethash/internal.c index 338aa5ec..0a830fc8 100644 --- a/src/libethash/internal.c +++ b/src/libethash/internal.c @@ -257,7 +257,7 @@ static bool ethash_hash( void ethash_quick_hash( ethash_h256_t* return_hash, ethash_h256_t const* header_hash, - uint64_t const nonce, + uint64_t nonce, ethash_h256_t const* mix_hash ) {