Replace memcpys by a static_cast and an integral promotion.