Open user78713 opened 6 years ago
Well, sgminer relies on undefined behaviour in several places, i.e.
uint8_t tmp[4]; *(uint32_t*) tmp = ...;
is undefined due to the different alignment of the data types, but it works on x86. Furthermore little endian is assumed in several places...
Therefore the implicit casts are not the biggest issue.
I'm cleaning up the code at the moment a little bit, but the CN code is really bad. Furthermore the Monero v7 commit is still broken and needs to be fixed first.
FYI, following code is "unsafe" due to implicit castings:
CNKeccak(CNCtx.State, Input, Length); ==> Input is uint8_t* but method expects uint64_t*
Also
Implicit casting is especially dangerous when dealing with pointers. Might lead to crashes in release mode.