On Mon, 2008-04-21 at 11:43 +0100, Andrew Haley wrote: > Why use a short and not an int? > > for (int i=MIN_VALUE; i <= MAX_VALUE; i++) > > would be more idiomatic and faster on many targets.
Same as I suggested. This would also apply to: --- java/lang/Character.java 19 Dec 2006 01:14:23 -0000 1.48 +++ java/lang/Character.java 14 Apr 2008 13:54:25 -0000 @@ -2055,6 +2055,11 @@ // this constant controls how much we actually cache. private static final int MAX_CACHE = 127; private static Character[] charCache = new Character[MAX_CACHE + 1]; + static + { + for (char i=0; i <= MAX_CACHE; i++) + charCache[i] = new Character(i); + } --- java/lang/Short.java 10 Dec 2006 20:25:44 -0000 1.20 +++ java/lang/Short.java 14 Apr 2008 13:54:25 -0000 @@ -90,6 +90,11 @@ private static final int MIN_CACHE = -128; private static final int MAX_CACHE = 127; private static Short[] shortCache = new Short[MAX_CACHE - MIN_CACHE + 1]; + static + { + for (short i=MIN_CACHE; i <= MAX_CACHE; i++) + shortCache[i - MIN_CACHE] = new Short(i); + } - twisti