Fix the UnpackedObjectCache hash function to prevent overflow
commita0a472a898a26cf5ad6ae6b84fa3705350b2abb7
authorShawn O. Pearce <spearce@spearce.org>
Tue, 30 Sep 2008 07:47:50 +0000 (30 00:47 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 3 Oct 2008 06:22:55 +0000 (3 08:22 +0200)
treea6bbb9db81c164735d6272681ba9001e86485736
parent101d132c0703f06bfa6ecc1e6928b3d718db3a11
Fix the UnpackedObjectCache hash function to prevent overflow

Sometimes we got negative array indexes inside of the cache due
to WindowedFile.hash having a negative value assigned by the JVM.
We now use only the lower 8 bits as the cache is fixed to at most
256 entries.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectCache.java