@ExposedMethod(type = MethodType.BINARY, defaults = {"null"}, doc = BuiltinDocs.long___pow___doc) final PyObject long___pow__(PyObject right, PyObject modulo) { if (!canCoerce(right)) { return null; } modulo = (modulo == Py.None) ? null : modulo; if (modulo != null && !canCoerce(modulo)) { return null; } return _pow(getValue(), coerce(right), modulo, this, right); }
@ExposedMethod(type = MethodType.CMP, doc = BuiltinDocs.long___cmp___doc) final int long___cmp__(PyObject other) { if (!canCoerce(other)) { return -2; } return getValue().compareTo(coerce(other)); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___add___doc) final PyObject long___add__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(getValue().add(coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rand___doc) final PyObject long___rand__(PyObject left) { if (!canCoerce(left)) { return null; } return Py.newLong(coerce(left).and(getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___sub___doc) final PyObject long___sub__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(getValue().subtract(coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___and___doc) final PyObject long___and__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(getValue().and(coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rshift___doc) final PyObject long___rshift__(PyObject right) { if (!canCoerce(right)) { return null; } int rightv = coerceInt(right); if (rightv < 0) { throw Py.ValueError("negative shift count"); } return Py.newLong(getValue().shiftRight(rightv)); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___lshift___doc) final PyObject long___lshift__(PyObject right) { if (!canCoerce(right)) { return null; } int rightv = coerceInt(right); if (rightv < 0) { throw Py.ValueError("negative shift count"); } return Py.newLong(getValue().shiftLeft(rightv)); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rtruediv___doc) final PyObject long___rtruediv__(PyObject left) { if (!canCoerce(left)) { return null; } return true_divide(coerce(left), this.getValue()); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___truediv___doc) final PyObject long___truediv__(PyObject right) { if (!canCoerce(right)) { return null; } return true_divide(this.getValue(), coerce(right)); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rmul___doc) final PyObject long___rmul__(PyObject left) { if (left instanceof PySequence) { return ((PySequence)left).repeat(coerceInt(this)); } if (!canCoerce(left)) { return null; } return Py.newLong(coerce(left).multiply(getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___ror___doc) final PyObject long___ror__(PyObject left) { if (!canCoerce(left)) { return null; } return Py.newLong(coerce(left).or(getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___floordiv___doc) final PyObject long___floordiv__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(divide(getValue(), coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rfloordiv___doc) final PyObject long___rfloordiv__(PyObject left) { if (!canCoerce(left)) { return null; } return Py.newLong(divide(coerce(left), getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rxor___doc) final PyObject long___rxor__(PyObject left) { if (!canCoerce(left)) { return null; } return Py.newLong(coerce(left).xor(getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___xor___doc) final PyObject long___xor__(PyObject right) { if (!canCoerce(right)) { return null; } return Py.newLong(getValue().xor(coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rdiv___doc) final PyObject long___rdiv__(PyObject left) { if (!canCoerce(left)) { return null; } if (Options.division_warning > 0) { Py.warning(Py.DeprecationWarning, "classic long division"); } return Py.newLong(divide(coerce(left), getValue())); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___div___doc) final PyObject long___div__(PyObject right) { if (!canCoerce(right)) { return null; } if (Options.division_warning > 0) { Py.warning(Py.DeprecationWarning, "classic long division"); } return Py.newLong(divide(getValue(), coerce(right))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___mod___doc) final PyObject long___mod__(PyObject right) { if (!canCoerce(right)) { return null; } BigInteger rightv = coerce(right); return Py.newLong(modulo(getValue(), rightv, divide(getValue(), rightv))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rdivmod___doc) final PyObject long___rdivmod__(PyObject left) { if (!canCoerce(left)) { return null; } BigInteger leftv = coerce(left); BigInteger xdivy = divide(leftv, getValue()); return new PyTuple(Py.newLong(xdivy), Py.newLong(modulo(leftv, getValue(), xdivy))); }