提交 97514b2d authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use BitSet.valueOf(byte[]) in Recover

上级 e17bd6a3
...@@ -1248,15 +1248,10 @@ public class Recover extends Tool implements DataHandler { ...@@ -1248,15 +1248,10 @@ public class Recover extends Tool implements DataHandler {
private int dumpPageFreeList(PrintWriter writer, Data s, long pageId, private int dumpPageFreeList(PrintWriter writer, Data s, long pageId,
long pageCount) { long pageCount) {
int pagesAddressed = PageFreeList.getPagesAddressed(pageSize); int pagesAddressed = PageFreeList.getPagesAddressed(pageSize);
BitSet used = new BitSet(); int len = pagesAddressed >> 3;
for (int i = 0; i < pagesAddressed; i += 8) { byte[] b = new byte[len];
int x = s.readByte() & 255; s.read(b, 0, len);
for (int j = 0; j < 8; j++) { BitSet used = BitSet.valueOf(b);
if ((x & (1 << j)) != 0) {
used.set(i + j);
}
}
}
int free = 0; int free = 0;
for (long i = 0, j = pageId; i < pagesAddressed && j < pageCount; i++, j++) { for (long i = 0, j = pageId; i < pagesAddressed && j < pageCount; i++, j++) {
if (i == 0 || j % 100 == 0) { if (i == 0 || j % 100 == 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论