diff --git a/endian.h b/endian.h index 5a05b444b..0ee402d9a 100644 --- a/endian.h +++ b/endian.h @@ -42,11 +42,11 @@ #if LITTLE_ENDIAN == BYTE_ORDER #define fix_endian32(dst_ ,src_) dst_ = src_ -#define fix_endian32_same(val_) +#define fix_endian32_same(val_) #define fix_endian64(dst_, src_) dst_ = src_ -#define fix_endian64_same(val_) +#define fix_endian64_same(val_) #define fix_endian_arr32(arr_, size_) -#define fix_endian_arr64(arr_, size_) +#define fix_endian_arr64(arr_, size_) #elif BIG_ENDIAN == BYTE_ORDER @@ -54,18 +54,18 @@ #define fix_endian32_same(val_) val_ = ethash_swap_u32(val_) #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" diff --git a/fnv.h b/fnv.h index edabeaae2..d23c4e247 100644 --- a/fnv.h +++ b/fnv.h @@ -29,10 +29,11 @@ extern "C" { #define FNV_PRIME 0x01000193 -static inline uint32_t fnv_hash(const uint32_t x, const uint32_t y) { - return x*FNV_PRIME ^ y; +static inline uint32_t fnv_hash(uint32_t const x, uint32_t const y) +{ + return x * FNV_PRIME ^ y; } #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/internal.h b/internal.h index 3d340512d..e5a34f350 100644 --- a/internal.h +++ b/internal.h @@ -32,26 +32,30 @@ typedef union node { } node; struct ethash_light { - ethash_cache *cache; + ethash_cache* cache; }; struct ethash_full { - FILE *file; + FILE* file; size_t file_size; - ethash_cache *cache; - node *data; + ethash_cache* cache; + node* data; ethash_callback_t callback; }; -void ethash_calculate_dag_item(node *const ret, - const unsigned node_index, - ethash_params const *params, - ethash_cache const *cache); - -void ethash_quick_hash(ethash_h256_t *return_hash, - ethash_h256_t const *header_hash, - const uint64_t nonce, - ethash_h256_t const *mix_hash); +void ethash_calculate_dag_item( + node* const ret, + const unsigned node_index, + ethash_params const* params, + ethash_cache const* cache +); + +void ethash_quick_hash( + ethash_h256_t* return_hash, + ethash_h256_t const* header_hash, + const uint64_t nonce, + ethash_h256_t const* mix_hash +); #ifdef __cplusplus } diff --git a/sha3.h b/sha3.h index bf9d1c481..a38006292 100644 --- a/sha3.h +++ b/sha3.h @@ -11,17 +11,17 @@ extern "C" { struct ethash_h256; #define decsha3(bits) \ - int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t); + int sha3_##bits(uint8_t*, size_t, uint8_t const*, size_t); decsha3(256) decsha3(512) -static inline void SHA3_256(struct ethash_h256 const* ret, uint8_t const *data, const size_t size) +static inline void SHA3_256(struct ethash_h256 const* ret, uint8_t const* data, size_t const size) { sha3_256((uint8_t*)ret, 32, data, size); } -static inline void SHA3_512(uint8_t *ret, uint8_t const *data, const size_t size) +static inline void SHA3_512(uint8_t* ret, uint8_t const* data, size_t const size) { sha3_512(ret, 64, data, size); } diff --git a/sha3_cryptopp.cpp b/sha3_cryptopp.cpp index 13d090b15..2a7c02664 100644 --- a/sha3_cryptopp.cpp +++ b/sha3_cryptopp.cpp @@ -25,12 +25,12 @@ extern "C" { struct ethash_h256; typedef struct ethash_h256 ethash_h256_t; -void SHA3_256(ethash_h256_t const* ret, const uint8_t *data, size_t size) +void SHA3_256(ethash_h256_t const* ret, uint8_t const* data, size_t size) { CryptoPP::SHA3_256().CalculateDigest((uint8_t*)ret, data, size); } -void SHA3_512(uint8_t *const ret, const uint8_t *data, size_t size) +void SHA3_512(uint8_t* const ret, uint8_t const* data, size_t size) { CryptoPP::SHA3_512().CalculateDigest(ret, data, size); } diff --git a/sha3_cryptopp.h b/sha3_cryptopp.h index 47da9427b..cc81f2855 100644 --- a/sha3_cryptopp.h +++ b/sha3_cryptopp.h @@ -11,8 +11,8 @@ extern "C" { struct ethash_h256; typedef struct ethash_h256 ethash_h256_t; -void SHA3_256(ethash_h256_t *const ret, const uint8_t *data, size_t size); -void SHA3_512(uint8_t *const ret, const uint8_t *data, size_t size); +void SHA3_256(ethash_h256_t const* ret, uint8_t const* data, size_t size); +void SHA3_512(uint8_t* const ret, uint8_t const* data, size_t size); #ifdef __cplusplus } diff --git a/util.c b/util.c index d635477f1..615ca3243 100644 --- a/util.c +++ b/util.c @@ -25,9 +25,9 @@ #ifdef _MSC_VER // foward declare without all of Windows.h -__declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString); +__declspec(dllimport) void __stdcall OutputDebugStringA(char const* lpOutputString); -void debugf(const char *str, ...) +void debugf(char const* str, ...) { va_list args; va_start(args, str); diff --git a/util.h b/util.h index ba8957815..c5fc6e55b 100644 --- a/util.h +++ b/util.h @@ -27,7 +27,7 @@ extern "C" { #endif #ifdef _MSC_VER -void debugf(const char *str, ...); +void debugf(char const* str, ...); #else #define debugf printf #endif