public static EcmaValue RightShift(this EcmaValue x, EcmaValue y) { switch (EcmaValue.GetNumberCoercion(x, y)) { case EcmaNumberType.BigInt: return(BigIntHelper.RightShift(x, y)); case EcmaNumberType.BigInt64: return(BigIntHelper.RightShift64(x, y)); } return((+x).ToInt32() >> (+y).ToInt32()); }
public static EcmaValue Pow(this EcmaValue x, EcmaValue y) { switch (EcmaValue.GetNumberCoercion(x, y)) { case EcmaNumberType.BigInt: return(BigIntHelper.Pow(x, y)); case EcmaNumberType.BigInt64: return(BigIntHelper.Pow64(x, y)); } return(EcmaMath.Pow(x, y)); }
public static EcmaValue BitwiseOr(this EcmaValue x, EcmaValue y) { switch (EcmaValue.GetNumberCoercion(x, y)) { case EcmaNumberType.BigInt: return(BigIntHelper.BitwiseOr(x, y)); case EcmaNumberType.BigInt64: return(BigIntHelper.BitwiseOr64(x, y)); } return((+x).ToInt32() | (+y).ToInt32()); }
public static EcmaValue BigIntLiteral(string str) { Guard.ArgumentNotNull(str, "str"); if (str.Length == 0) { throw new ArgumentException("Literal cannot be empty", "str"); } if (str[str.Length - 1] == 'n') { str = str.Substring(0, str.Length - 1); } // negative non-decimal is not valid BigInt string (error thrown when passed to BigInt constructor) // but included here as text like -0xfn can produce intended value if (str[0] == '-') { return(-BigIntHelper.ToBigInt(str.Substring(1))); } return(BigIntHelper.ToBigInt(str)); }
public static EcmaValue BigIntLiteral(long value) { return(BigIntHelper.ToBigInt(value)); }