Add static_cast to assertion to silence sign/unsigned comparison warning.