Пример #1
0
 public static int GetBoundIndexClamped(EcmaValue index, int len, int defaultValue)
 {
     if (index == default)
     {
         return(defaultValue);
     }
     index = index.ToInteger();
     return((index < 0 ? 0 : EcmaMath.Min(index, len)).ToInt32());
 }
Пример #2
0
 public static long GetBoundIndex(EcmaValue index, long len, long defaultValue)
 {
     if (index == default)
     {
         return(defaultValue);
     }
     index = index.ToInteger();
     return((index < 0 ? EcmaMath.Max(len + index, 0) : EcmaMath.Min(index, len)).ToInt64());
 }
Пример #3
0
        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));
        }