mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 20:19:23 +00:00
Make round size power of 2
This commit is contained in:
parent
f3ea3c5227
commit
c4db1435b2
2 changed files with 25 additions and 3 deletions
|
@ -62,7 +62,19 @@ std::atomic<bool> CudaWorker::ready;
|
||||||
|
|
||||||
|
|
||||||
static inline bool isReady() { return !Nonce::isPaused() && CudaWorker::ready; }
|
static inline bool isReady() { return !Nonce::isPaused() && CudaWorker::ready; }
|
||||||
static inline uint32_t roundSize(uint32_t intensity) { return kReserveCount / intensity + 1; }
|
|
||||||
|
|
||||||
|
static inline uint32_t roundSize(uint32_t intensity)
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
unsigned long index;
|
||||||
|
_BitScanReverse(&index, intensity - 1);
|
||||||
|
const uint32_t n = 31 - index;
|
||||||
|
#else
|
||||||
|
const uint32_t n = __builtin_clz(intensity - 1);
|
||||||
|
#endif
|
||||||
|
return 1U << (32 - n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace xmrig
|
} // namespace xmrig
|
||||||
|
|
|
@ -56,12 +56,22 @@
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint32_t kReserveCount = 32768;
|
|
||||||
std::atomic<bool> OclWorker::ready;
|
std::atomic<bool> OclWorker::ready;
|
||||||
|
|
||||||
|
|
||||||
static inline bool isReady() { return !Nonce::isPaused() && OclWorker::ready; }
|
static inline bool isReady() { return !Nonce::isPaused() && OclWorker::ready; }
|
||||||
static inline uint32_t roundSize(uint32_t intensity) { return kReserveCount / intensity + 1; }
|
|
||||||
|
static inline uint32_t roundSize(uint32_t intensity)
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
unsigned long index;
|
||||||
|
_BitScanReverse(&index, intensity - 1);
|
||||||
|
const uint32_t n = 31 - index;
|
||||||
|
#else
|
||||||
|
const uint32_t n = __builtin_clz(intensity - 1);
|
||||||
|
#endif
|
||||||
|
return 1U << (32 - n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void printError(size_t id, const char *error)
|
static inline void printError(size_t id, const char *error)
|
||||||
|
|
Loading…
Reference in a new issue