cast rc to size_t for comparisons

avoids -Wall failures comparing int to uint