Browse Source

subtree bump: libethash

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
27493d36e5
  1. 2
      libethash/internal.c
  2. 6
      libethash/internal.h
  3. 9
      libethash/io.h
  4. 2
      libethash/io_win32.c

2
libethash/internal.c

@ -280,7 +280,7 @@ ethash_h256_t ethash_get_seedhash(uint64_t block_number)
return ret;
}
int ethash_quick_check_difficulty(
bool ethash_quick_check_difficulty(
ethash_h256_t const* header_hash,
uint64_t const nonce,
ethash_h256_t const* mix_hash,

6
libethash/internal.h

@ -47,7 +47,7 @@ static inline void ethash_h256_reset(ethash_h256_t* hash)
}
// Returns if hash is less than or equal to difficulty
static inline int ethash_check_difficulty(
static inline bool ethash_check_difficulty(
ethash_h256_t const* hash,
ethash_h256_t const* difficulty
)
@ -59,10 +59,10 @@ static inline int ethash_check_difficulty(
}
return ethash_h256_get(hash, i) < ethash_h256_get(difficulty, i);
}
return 1;
return true;
}
int ethash_quick_check_difficulty(
bool ethash_quick_check_difficulty(
ethash_h256_t const* header_hash,
uint64_t const nonce,
ethash_h256_t const* mix_hash,

9
libethash/io.h

@ -34,11 +34,12 @@
extern "C" {
#endif
// Maximum size for mutable part of DAG file name
// 6 is for "full-R", the suffix of the filename
// 10 is for maximum number of digits of a uint32_t (for REVISION)
// 1 is for _ and 16 is for the first 16 hex digits for first 8 bytes of
// 1 is for - and 16 is for the first 16 hex digits for first 8 bytes of
// the seedhash and last 1 is for the null terminating character
// Reference: https://github.com/ethereum/wiki/wiki/Ethash-DAG
#define DAG_MUTABLE_NAME_MAX_SIZE (10 + 1 + 16 + 1)
#define DAG_MUTABLE_NAME_MAX_SIZE (6 + 10 + 1 + 16 + 1)
/// Possible return values of @see ethash_io_prepare
enum ethash_io_rc {
ETHASH_IO_FAIL = 0, ///< There has been an IO failure
@ -49,7 +50,7 @@ enum ethash_io_rc {
// small hack for windows. I don't feel I should use va_args and forward just
// to have this one function properly cross-platform abstracted
#if defined(_WIN32)
#if defined(_WIN32) && !defined(__GNUC__)
#define snprintf(...) sprintf_s(__VA_ARGS__)
#endif
@ -176,7 +177,7 @@ static inline bool ethash_io_mutable_name(
#if LITTLE_ENDIAN == BYTE_ORDER
hash = ethash_swap_u64(hash);
#endif
return snprintf(output, DAG_MUTABLE_NAME_MAX_SIZE, "%u_%016" PRIx64, revision, hash) >= 0;
return snprintf(output, DAG_MUTABLE_NAME_MAX_SIZE, "full-R%u-%016" PRIx64, revision, hash) >= 0;
}
#ifdef __cplusplus

2
libethash/io_win32.c

@ -25,7 +25,7 @@
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <Shlobj.h>
#include <shlobj.h>
FILE* ethash_fopen(char const* file_name, char const* mode)
{

Loading…
Cancel
Save