This is a C/C++ programming question related to CPU mining. In the source code for CPU miners wolf-xmr-miner, cpuminer-multi et al there is a function called scanhash_cryptonight
that has this the following prototype:
int scanhash_cryptonight(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done);
The parameters pdata
and ptarget
are pointers to members of a struct that looks like this:
struct work {
uint32_t data[32];
uint32_t target[8];
/* ... */
};
Now when scanhash_cryptonight
is called there is this nonceptr
variable that is initialized like this (link to scanhash function):
uint32_t *nonceptr = (uint32_t*) (((char*)pdata) + 39);
My question is: what is the value of nonceptr
used for and what is the casting in the expresssion doing?