@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___rlshift___doc) final PyObject long___rlshift__(PyObject left) { if (!canCoerce(left)) { return null; } if (getValue().intValue() < 0) { throw Py.ValueError("negative shift count"); } return Py.newLong(coerce(left).shiftLeft(coerceInt(this))); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.long___rrshift___doc) final PyObject long___rrshift__(PyObject left) { if (!canCoerce(left)) { return null; } if (getValue().intValue() < 0) { throw Py.ValueError("negative shift count"); } return Py.newLong(coerce(left).shiftRight(coerceInt(this))); }
@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___mul___doc) final PyObject long___mul__(PyObject right) { if (right instanceof PySequence) { return ((PySequence)right).repeat(coerceInt(this)); } if (!canCoerce(right)) { return null; } return Py.newLong(getValue().multiply(coerce(right))); }