|
|
|
@ -38,6 +38,7 @@ import java.io.ObjectStreamException;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
|
|
|
|
|
|
import org.mcmodule.util.IntArrayAllcator;
|
|
|
|
|
import org.mcmodule.util.ObjectAllocator;
|
|
|
|
@ -218,6 +219,21 @@ public class BigInteger extends Number implements Comparable<BigInteger>, Recycl
|
|
|
|
|
private float cachedFloat;
|
|
|
|
|
private double cachedDouble;
|
|
|
|
|
|
|
|
|
|
private static final AtomicLong createCounter = new AtomicLong(),
|
|
|
|
|
freeCounter = new AtomicLong();
|
|
|
|
|
|
|
|
|
|
public static long getAndClearCreateCounter() {
|
|
|
|
|
return createCounter.getAndSet(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static long getAndClearFreeCounter() {
|
|
|
|
|
return freeCounter.getAndSet(0);
|
|
|
|
|
}
|
|
|
|
|
// Stupid lags.
|
|
|
|
|
// protected void finalize() {
|
|
|
|
|
// freeCounter.incrementAndGet();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This mask is used to obtain the value of an int as if it were unsigned.
|
|
|
|
|
*/
|
|
|
|
@ -332,6 +348,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>, Recycl
|
|
|
|
|
this.currentAllocator = allocator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
createCounter.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Translates a byte array containing the two's-complement binary
|
|
|
|
|
* representation of a BigInteger into a BigInteger. The input array is
|
|
|
|
|