Consistently use uint8_t in casts.

Requested by Wez Furlong.