make faster safe_int conversion