Div by zero

This commit is contained in:
Maxim Shafirov
2012-03-26 14:24:19 +04:00
parent de14910d4a
commit 957a0bbfb0
@@ -222,6 +222,9 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
if (fileSize > 5 * megabyte) { // file is longer than 5MB and (more than 50% of keys is garbage or approximate benefit larger than 100M)
int liveKeys = (int)(myLiveAndGarbageKeysCounter / LIVE_KEY_MASK);
int deadKeys = (int)(myLiveAndGarbageKeysCounter & 0xFFFFFFFF);
if (deadKeys < 50) return false;
final int benefitSize = 100 * megabyte;
final long avgValueSize = fileSize / (liveKeys + deadKeys);