/// <summary>
/// Converts a BigInteger to int if it is small enough
/// </summary>
/// <param name="x">The value to convert</param>
/// <returns>An int if x is small enough, otherwise x.</returns>
/// <remarks>
/// Use this helper to downgrade BigIntegers as necessary.
/// </remarks>
public static object/*!*/ Normalize(BigInteger/*!*/ x) {
int result;
if (x.AsInt32(out result)) {
return ScriptingRuntimeHelpers.Int32ToObject(result);
}
return x;
}