rts: Fix platform-dependent pointer casts
Previously we had unnecessary (and incorrect) platform-dependent casts
to turn OSThreadIdss into a integer. We now just uniformly cast first
to a uintptr_t (which is always safe, regardless of whether
OSThreadId is a pointer), and then cast to the desired integral type.
This fixes a warning on musl platforms.