|
@ -34,11 +34,12 @@ |
|
|
extern "C" { |
|
|
extern "C" { |
|
|
#endif |
|
|
#endif |
|
|
// Maximum size for mutable part of DAG file name
|
|
|
// 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)
|
|
|
// 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
|
|
|
// the seedhash and last 1 is for the null terminating character
|
|
|
// Reference: https://github.com/ethereum/wiki/wiki/Ethash-DAG
|
|
|
// 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
|
|
|
/// Possible return values of @see ethash_io_prepare
|
|
|
enum ethash_io_rc { |
|
|
enum ethash_io_rc { |
|
|
ETHASH_IO_FAIL = 0, ///< There has been an IO failure
|
|
|
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
|
|
|
// 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
|
|
|
// to have this one function properly cross-platform abstracted
|
|
|
#if defined(_WIN32) |
|
|
#if defined(_WIN32) && !defined(__GNUC__) |
|
|
#define snprintf(...) sprintf_s(__VA_ARGS__) |
|
|
#define snprintf(...) sprintf_s(__VA_ARGS__) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -176,7 +177,7 @@ static inline bool ethash_io_mutable_name( |
|
|
#if LITTLE_ENDIAN == BYTE_ORDER |
|
|
#if LITTLE_ENDIAN == BYTE_ORDER |
|
|
hash = ethash_swap_u64(hash); |
|
|
hash = ethash_swap_u64(hash); |
|
|
#endif |
|
|
#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 |
|
|
#ifdef __cplusplus |
|
|