@Override public PyLong read(Kryo kryo, Input input, Class<PyLong> type) { int length = input.readShort(); return new PyLong(new BigInteger(input.readBytes(length))); } }
return new PyLong((BigInteger) number); } else { return Py.java2py(number);
public static PyLong newLong(java.math.BigInteger i) { return new PyLong(i); }
public static PyObject newInteger(long i) { if (i < Integer.MIN_VALUE || i > Integer.MAX_VALUE) { return new PyLong(i); } else { return newInteger((int) i); } }
@ExposedMethod final PyLong Random_getrandbits(int k) { return new PyLong(new BigInteger(k, javaRandom)); } }
Object unpack(ByteStream buf) { long v = BEreadInt(buf); if (v < 0) v += 0x100000000L; return new PyLong(v); } }
private static PyObject _sub(int a, int b) { int x = a - b; if ((x ^ a) >= 0 || (x ^ ~b) >= 0) { return Py.newInteger(x); } return new PyLong((long)a - (long)b); }
Object unpack(ByteStream buf) { long v = LEreadInt(buf); if (v < 0) v += 0x100000000L; return new PyLong(v); } }
@ExposedGet(name = "__flags__") public PyLong getFlags() { return new PyLong(tp_flags); }
Object unpack(ByteStream buf) { long high = ( BEreadInt( buf ) & 0X00000000FFFFFFFFL ); long low = ( BEreadInt( buf ) & 0X00000000FFFFFFFFL ); java.math.BigInteger result=java.math.BigInteger.valueOf(high); result=result.multiply(java.math.BigInteger.valueOf(0x100000000L)); result=result.add(java.math.BigInteger.valueOf(low)); return new PyLong(result); } }
Object unpack(ByteStream buf) { long low = ( LEreadInt( buf ) & 0X00000000FFFFFFFFL ); long high = ( LEreadInt( buf ) & 0X00000000FFFFFFFFL ); java.math.BigInteger result=java.math.BigInteger.valueOf(high); result=result.multiply(java.math.BigInteger.valueOf(0x100000000L)); result=result.add(java.math.BigInteger.valueOf(low)); return new PyLong(result); } }
final private void load_long() { String line = file.readlineNoNl(); push(new PyLong(line.substring(0, line.length()-1))); }
@ExposedMethod(doc = BuiltinDocs.long___getnewargs___doc) final PyTuple long___getnewargs__() { return new PyTuple(new PyLong(this.getValue())); }
Object unpack(ByteStream buf) { long low = LEreadInt(buf) & 0x00000000FFFFFFFFL; long high = ((long)(LEreadInt(buf))<<32) & 0xFFFFFFFF00000000L; long result=(high|low); return new PyLong(result); } }
Object unpack(ByteStream buf) { long high = ((long)(BEreadInt(buf))<<32) & 0xFFFFFFFF00000000L; long low = BEreadInt(buf) & 0x00000000FFFFFFFFL; long result=(high|low); return new PyLong(result); } }
@ExposedMethod(doc = BuiltinDocs.float___long___doc) final PyObject float___long__() { return new PyLong(getValue()); }
@ExposedMethod(doc = BuiltinDocs.int___long___doc) final PyObject int___long__() { return new PyLong(getValue()); }
public void testMod() { interp.exec("c = b % a"); assertEquals(new PyLong(4000000000L), interp.get("c")); } }
@ExposedMethod(doc = BuiltinDocs.int___neg___doc) final PyObject int___neg__() { long x = getValue(); long result = -x; // check for overflow if (x < 0 && result == x) { return new PyLong(x).__neg__(); } return Py.newInteger(result); }