On 09/06/2011 08:07 PM, Charles Oliver Nutter wrote: > I also thought of an existing API that would benefit from this, and > perhaps there's a path to getting something in JDK 7 (unofficially) > and JDK 8 (officially): BigInteger. Ideally BigInteger should only use > a primitive long (or int?) up to its limits, and not allocate an array > until it exceeds those limits. Such an implementation would need to do > the same overflow checks JRuby does, and could benefit from > addDetectingOverflow. And we know there's constant cries for > BigInteger and BigDecimal perf to be improved...so I'd say every bit > helps.
Kawa's gnu.math.IntNum already does this. It has only two fields: /** All integers are stored in 2's-complement form. * If words == null, the ival is the value of this IntNum. * Otherwise, the first ival elements of words make the value * of this IntNum, stored in little-endian order, 2's-complement form. */ public int ival; public int[] words; I assume this is one reason why Kawa's IntNum is (mostly) faster than BigInteger. -- --Per Bothner p...@bothner.com http://per.bothner.com/ _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev