提交 a619d5c6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Remove unused code.

上级 2d52516f
...@@ -54,7 +54,6 @@ public class CacheLRU implements Cache { ...@@ -54,7 +54,6 @@ public class CacheLRU implements Cache {
this.setMaxMemory(maxMemoryKb); this.setMaxMemory(maxMemoryKb);
this.len = MathUtils.nextPowerOf2(maxMemory / 64); this.len = MathUtils.nextPowerOf2(maxMemory / 64);
this.mask = len - 1; this.mask = len - 1;
MathUtils.checkPowerOf2(len);
clear(); clear();
} }
...@@ -100,7 +99,7 @@ public class CacheLRU implements Cache { ...@@ -100,7 +99,7 @@ public class CacheLRU implements Cache {
int pos = rec.getPos(); int pos = rec.getPos();
CacheObject old = find(pos); CacheObject old = find(pos);
if (old != null) { if (old != null) {
DbException.throwInternalError("try to add a record twice pos:" + pos); DbException.throwInternalError("try to add a record twice at pos " + pos);
} }
} }
int index = rec.getPos() & mask; int index = rec.getPos() & mask;
......
...@@ -221,18 +221,6 @@ public class MathUtils { ...@@ -221,18 +221,6 @@ public class MathUtils {
return (x + blockSizePowerOf2 - 1) & (-blockSizePowerOf2); return (x + blockSizePowerOf2 - 1) & (-blockSizePowerOf2);
} }
/**
* Check if a value is a power of two.
*
* @param len the value to check
* @throws RuntimeException if it is not a power of two
*/
public static void checkPowerOf2(int len) {
if ((len & (len - 1)) != 0 && len > 0) {
DbException.throwInternalError("not a power of 2: " + len);
}
}
/** /**
* Get the value that is equal or higher than this value, and that is a * Get the value that is equal or higher than this value, and that is a
* power of two. * power of two.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论