mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-11 05:14:40 +00:00
Some small fixes.
This commit is contained in:
parent
244ca93aa4
commit
83e5832bc1
2 changed files with 12 additions and 9 deletions
|
@ -24,13 +24,18 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
|
||||
# define bit_AES (1 << 25)
|
||||
# define bit_BMI2 (1 << 8)
|
||||
#else
|
||||
# include <cpuid.h>
|
||||
#endif
|
||||
|
||||
#ifndef bit_AES
|
||||
# define bit_AES (1 << 25)
|
||||
#endif
|
||||
|
||||
#ifndef bit_BMI2
|
||||
# define bit_BMI2 (1 << 8)
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
@ -87,7 +92,7 @@ static inline bool has_aes_ni()
|
|||
int cpu_info[4] = { 0 };
|
||||
cpuid(PROCESSOR_INFO, cpu_info);
|
||||
|
||||
return cpu_info[ECX_Reg] & bit_AES;
|
||||
return (cpu_info[ECX_Reg] & bit_AES) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +100,7 @@ static inline bool has_bmi2() {
|
|||
int cpu_info[4] = { 0 };
|
||||
cpuid(EXTENDED_FEATURES, cpu_info);
|
||||
|
||||
return cpu_info[EBX_Reg] & bit_BMI2;
|
||||
return (cpu_info[EBX_Reg] & bit_BMI2) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ static inline void cn_implode_scratchpad(const __m128i *input, __m128i *output)
|
|||
|
||||
|
||||
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, bool MONERO>
|
||||
inline bool cryptonight_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
inline void cryptonight_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
{
|
||||
keccak(static_cast<const uint8_t*>(input), (int) size, ctx->state0, 200);
|
||||
|
||||
|
@ -364,12 +364,11 @@ inline bool cryptonight_hash(const void *__restrict__ input, size_t size, void *
|
|||
|
||||
keccakf(h0, 24);
|
||||
extra_hashes[ctx->state0[0] & 3](ctx->state0, 200, static_cast<char*>(output));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<size_t ITERATIONS, size_t MEM, size_t MASK, bool SOFT_AES, bool MONERO>
|
||||
inline bool cryptonight_double_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, struct cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
inline void cryptonight_double_hash(const void *__restrict__ input, size_t size, void *__restrict__ output, struct cryptonight_ctx *__restrict__ ctx, uint8_t version)
|
||||
{
|
||||
keccak((const uint8_t *) input, (int) size, ctx->state0, 200);
|
||||
keccak((const uint8_t *) input + size, (int) size, ctx->state1, 200);
|
||||
|
@ -463,7 +462,6 @@ inline bool cryptonight_double_hash(const void *__restrict__ input, size_t size,
|
|||
|
||||
extra_hashes[ctx->state0[0] & 3](ctx->state0, 200, static_cast<char*>(output));
|
||||
extra_hashes[ctx->state1[0] & 3](ctx->state1, 200, static_cast<char*>(output) + 32);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* __CRYPTONIGHT_X86_H__ */
|
||||
|
|
Loading…
Reference in a new issue