private static object LeftShift(BigInteger x, BigInteger y)
 {
     if (y < BigInteger.Zero) {
         throw Ops.ValueError("negative shift count");
     }
     int yint;
     if (y.AsInt32(out yint)) {
         return x << yint;
     }
     if (x == BigInteger.Zero) {
         return BigInteger.Zero;
     } else {
         throw Ops.OverflowError("number too big");
     }
 }
        public static object Compare(BigInteger x, object y)
        {
            if (y == null) return 1;

            int intVal;
            if (y is int) {
                if (x.AsInt32(out intVal)) return IntOps.Compare(intVal, y);
            } else if (y is ExtensibleInt) {
                if (x.AsInt32(out intVal)) return IntOps.Compare(intVal, ((ExtensibleInt)y).value);
            } else if (y is double) {
                return ((int)FloatOps.Compare((double)y, x)) * -1;
            } else if (y is ExtensibleFloat) {
                double dbl = x.ToFloat64();
                return FloatOps.Compare(dbl, ((ExtensibleFloat)y).value);
            } else if (y is bool) {
                if (x.AsInt32(out intVal)) return IntOps.Compare(intVal, ((bool)y) ? 1 : 0);
            } else if (y is decimal) {
                double dbl = x.ToFloat64();
                return FloatOps.Compare(dbl, y);
            }

            BigInteger bi;
            if (!Converter.TryConvertToBigInteger(y, out bi)) {
                object res = Ops.GetDynamicType(y).Coerce(y, x);
                if (res != Ops.NotImplemented && !(res is OldInstance)) {
                    return Ops.Compare(((Tuple)res)[1], ((Tuple)res)[0]);
                }
                return Ops.NotImplemented;
            }

            BigInteger diff = x - bi;
            if (diff == 0) return 0;
            else if (diff < 0) return -1;
            else return 1;
        }