We now use size_t <-> int casts to avoid compiler warnings
I wasn't sure what assembly actually results from these casts and looked it up:
Pointer to pointer casts are no-op
If you did static_cast<int> on a float type, this would require a call to __ftoi, plus a couple of moves
unsigned to signed also causes a conversion, but this can be done with an addition and move to deal with the twos complement (so incredibly minor)
The CUDA guide advises us to use unsigned integers for loops (as apparently the overflow is better defined and easier/quicker to deal with). So maybe we should just use uints?
We now use size_t <-> int casts to avoid compiler warnings
I wasn't sure what assembly actually results from these casts and looked it up:
static_cast<int>
on a float type, this would require a call to__ftoi
, plus a couple of movesThe CUDA guide advises us to use unsigned integers for loops (as apparently the overflow is better defined and easier/quicker to deal with). So maybe we should just use uints?
Originally posted by @johnlees in https://github.com/mrc-ide/sircovid/issues/179#issuecomment-752068907