@Override public PyObject __long__() { return int___long__(); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___truediv___doc) final PyObject int___truediv__(PyObject right) { if (right instanceof PyInteger) { return __float__().__truediv__(right); } else if (right instanceof PyLong) { return int___long__().__truediv__(right); } else { return null; } }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rtruediv___doc) final PyObject int___rtruediv__(PyObject left) { if (left instanceof PyInteger) { return left.__float__().__truediv__(this); } else if (left instanceof PyLong) { return left.__truediv__(int___long__()); } else { return null; } }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___and___doc) final PyObject int___and__(PyObject right) { int rightv; if (right instanceof PyInteger) { rightv = ((PyInteger)right).getValue(); } else if (right instanceof PyLong) { return int___long__().__and__(right); } else { return null; } return Py.newInteger(getValue() & rightv); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rxor___doc) final PyObject int___rxor__(PyObject left) { int leftv; if (left instanceof PyInteger) { leftv = ((PyInteger)left).getValue(); } else if (left instanceof PyLong) { return left.__rxor__(int___long__()); } else { return null; } return Py.newInteger(leftv ^ getValue()); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___xor___doc) final PyObject int___xor__(PyObject right) { int rightv; if (right instanceof PyInteger) { rightv = ((PyInteger)right).getValue(); } else if (right instanceof PyLong) { return int___long__().__xor__(right); } else { return null; } return Py.newInteger(getValue() ^ rightv); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___or___doc) final PyObject int___or__(PyObject right) { int rightv; if (right instanceof PyInteger) { rightv = ((PyInteger)right).getValue(); } else if (right instanceof PyLong) { return int___long__().__or__(right); } else { return null; } return Py.newInteger(getValue() | rightv); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rshift___doc) final PyObject int___rshift__(PyObject right) { int rightv; if (right instanceof PyInteger) { rightv = ((PyInteger)right).getValue(); } else if (right instanceof PyLong) { return int___long__().__rshift__(right); } else { return null; } if (rightv < 0) { throw Py.ValueError("negative shift count"); } if (rightv >= Integer.SIZE) { return Py.newInteger(getValue() < 0 ? -1 : 0); } return Py.newInteger(getValue() >> rightv); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rrshift___doc) final PyObject int___rrshift__(PyObject left) { int leftv; if (left instanceof PyInteger) { leftv = ((PyInteger)left).getValue(); } else if (left instanceof PyLong) { return left.__rshift__(int___long__()); } else { return null; } if (getValue() < 0) { throw Py.ValueError("negative shift count"); } if (getValue() >= Integer.SIZE) { return Py.newInteger(leftv < 0 ? -1 : 0); } return Py.newInteger(leftv >> getValue()); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___lshift___doc) final PyObject int___lshift__(PyObject right) { int rightv; if (right instanceof PyInteger) { rightv = ((PyInteger)right).getValue(); } else if (right instanceof PyLong) { return int___long__().__lshift__(right); } else { return null; } if (rightv >= Integer.SIZE) { return __long__().__lshift__(right); } else if (rightv < 0) { throw Py.ValueError("negative shift count"); } int result = getValue() << rightv; if (getValue() != result >> rightv) { return __long__().__lshift__(right); } return Py.newInteger(result); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rlshift___doc) final PyObject int___rlshift__(PyObject left) { int leftv; if (left instanceof PyInteger) { leftv = ((PyInteger)left).getValue(); } else if (left instanceof PyLong) { return left.__rlshift__(int___long__()); } else { return null; } if (getValue() >= Integer.SIZE) { return left.__long__().__lshift__(this); } else if (getValue() < 0) { throw Py.ValueError("negative shift count"); } int result = leftv << getValue(); if (leftv != result >> getValue()) { return left.__long__().__lshift__(this); } return Py.newInteger(result); }