Nice work EK, I think have have all your changes to this point merged (plus I uploaded a lot of cleanup changes to xel_miner.c & miner.h this morning).
One minor question. Visual Studio is complaining about the rotate functions like.
uint64_t rotl64(uint64_t x, unsigned int n)
{
const unsigned int mask = (CHAR_BIT * sizeof(x) - 1);
n &= mask; // avoid undef behaviour with NDEBUG. 0 overhead for most types / compilers
return (x << n) | (x >> ((-n)&mask));
}
with the error "unary minus operator applied to unsigned type, result still unsigned".
I switched it from being unsigned and it runs fine now, but not sure that's what you intended.
Strange, here it works flawlessly.
I have taken it from John Regehr's blog post on rotation functions in C (the branchless one) and adapted it accordingly.
http://blog.regehr.org/archives/1063
I think it would be best to check if the VC compiler generates the correct assembly with your change. Something like this:
rotl32:
movl %edi, %eax
movb %sil, %cl
roll %cl, %eax
ret
Or at least, in the worst case, sth like this:
rotl32:
movl %esi, %ecx
movl %edi, %eax
shll %cl, %eax
negl %ecx
shrl %cl, %edi
orl %eax, %edi
movl %edi, %eax
ret