tromp / cuckoo

a memory-bound graph-theoretic proof-of-work system
Other
822 stars 173 forks source link

Fixed some issues that showed up with Visual Studio #4

Closed TiimJiim closed 9 years ago

TiimJiim commented 9 years ago

I haven't investigated the 64->32 bit loss of precision warnings yet, I'm assuming the algorithm does the right thing. Not a good idea to put critical code into asserts since normally NDEBUG is defined for release builds and the code inside the assert will be removed completely.

TiimJiim commented 9 years ago

Apologies for any errors (most likely typos if any), I don't have a Linux machine to hand to test against.

tromp commented 9 years ago

dear Tim,

I haven't investigated the 64->32 bit loss of precision warnings yet, I'm assuming the algorithm does the right thing. Not a good idea to put critical code into asserts since normally NDEBUG is defined for release builds and the code inside the assert will be removed completely.

Thanks so much for reviewing my code!

Fix NDEBUG builds (don't put critical expressions in asserts).

Oops:(

Fix sign of length to SHA256 function.

I propagated the size_t around the various functions with a length argument.

Long is 32 bits on windows, so be explicit for 64-bit constants.

I replaced 1L by 1LL. Is the Visual Studio compiler happy with that as denoting a 64 bit int?

Worker function should return a value.

Yes, although a smart compiler could warn about unreachable code now if it understands pthread_exit semantics:)

I manually applied the patches since I expressed them a little differently here and there.

regards, -John

TiimJiim commented 9 years ago

1LL is guaranteed to be at least 64 bits, so that works fine.