加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0004-space-map-disk-fix-the-search-range-117.patch 999 Bytes
一键复制 编辑 原始数据 按行查看 历史
zero 提交于 2020-07-01 15:04 . rebuild package
From 529a7cf3f5d5780d5e44c8508d2d42903672f7e8 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 9 Apr 2019 21:36:22 +0800
Subject: [PATCH 4/4] [space-map-disk] fix the search range (#117)
---
persistent-data/space-maps/disk.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/persistent-data/space-maps/disk.cc b/persistent-data/space-maps/disk.cc
index ce6a42c..d8db76f 100644
--- a/persistent-data/space-maps/disk.cc
+++ b/persistent-data/space-maps/disk.cc
@@ -390,7 +390,8 @@ namespace {
bitmap bm(tm_, ie, bitmap_validator_);
unsigned bit_begin = (index == begin_index) ? (begin % ENTRIES_PER_BLOCK) : 0;
- unsigned bit_end = (index == end_index - 1) ? (end % ENTRIES_PER_BLOCK) : ENTRIES_PER_BLOCK;
+ unsigned bit_end = (index == end_index - 1) ?
+ (end - ENTRIES_PER_BLOCK * index) : ENTRIES_PER_BLOCK;
boost::optional<unsigned> maybe_b = bm.find_free(bit_begin, bit_end);
if (maybe_b) {
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化