compat: backport USHRT_MAX, SHRT_MAX and SHRT_MIN