Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
f056cde6
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f056cde6
编写于
7月 12, 2017
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'rs/use-div-round-up'
Code cleanup. * rs/use-div-round-up: use DIV_ROUND_UP
上级
768d0fe0
42c78a21
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
14 addition
and
15 deletion
+14
-15
builtin/gc.c
builtin/gc.c
+1
-1
builtin/grep.c
builtin/grep.c
+1
-1
builtin/log.c
builtin/log.c
+1
-1
builtin/receive-pack.c
builtin/receive-pack.c
+1
-1
diff.c
diff.c
+1
-1
ewah/ewah_bitmap.c
ewah/ewah_bitmap.c
+2
-2
imap-send.c
imap-send.c
+1
-1
sha1_name.c
sha1_name.c
+2
-3
shallow.c
shallow.c
+4
-4
未找到文件。
builtin/gc.c
浏览文件 @
f056cde6
...
...
@@ -149,7 +149,7 @@ static int too_many_loose_objects(void)
if
(
!
dir
)
return
0
;
auto_threshold
=
(
gc_auto_threshold
+
255
)
/
256
;
auto_threshold
=
DIV_ROUND_UP
(
gc_auto_threshold
,
256
)
;
while
((
ent
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strspn
(
ent
->
d_name
,
"0123456789abcdef"
)
!=
38
||
ent
->
d_name
[
38
]
!=
'\0'
)
...
...
builtin/grep.c
浏览文件 @
f056cde6
...
...
@@ -543,7 +543,7 @@ static void compile_submodule_options(const struct grep_opt *opt,
* submodule process has its own thread pool.
*/
argv_array_pushf
(
&
submodule_options
,
"--threads=%d"
,
(
num_threads
+
1
)
/
2
);
DIV_ROUND_UP
(
num_threads
,
2
)
);
/* Add Pathspecs */
argv_array_push
(
&
submodule_options
,
"--"
);
...
...
builtin/log.c
浏览文件 @
f056cde6
...
...
@@ -1308,7 +1308,7 @@ static struct commit *get_base_commit(const char *base_commit,
if
(
rev_nr
%
2
)
rev
[
i
]
=
rev
[
2
*
i
];
rev_nr
=
(
rev_nr
+
1
)
/
2
;
rev_nr
=
DIV_ROUND_UP
(
rev_nr
,
2
)
;
}
if
(
!
in_merge_bases
(
base
,
rev
[
0
]))
...
...
builtin/receive-pack.c
浏览文件 @
f056cde6
...
...
@@ -1806,7 +1806,7 @@ static const char *unpack_with_sideband(struct shallow_info *si)
static
void
prepare_shallow_update
(
struct
command
*
commands
,
struct
shallow_info
*
si
)
{
int
i
,
j
,
k
,
bitmap_size
=
(
si
->
ref
->
nr
+
31
)
/
32
;
int
i
,
j
,
k
,
bitmap_size
=
DIV_ROUND_UP
(
si
->
ref
->
nr
,
32
)
;
ALLOC_ARRAY
(
si
->
used_shallow
,
si
->
shallow
->
nr
);
assign_shallow_commits_to_refs
(
si
,
si
->
used_shallow
,
NULL
);
...
...
diff.c
浏览文件 @
f056cde6
...
...
@@ -2095,7 +2095,7 @@ static void show_dirstat_by_line(struct diffstat_t *data, struct diff_options *o
* bytes per "line".
* This is stupid and ugly, but very cheap...
*/
damage
=
(
damage
+
63
)
/
64
;
damage
=
DIV_ROUND_UP
(
damage
,
64
)
;
ALLOC_GROW
(
dir
.
files
,
dir
.
nr
+
1
,
dir
.
alloc
);
dir
.
files
[
dir
.
nr
].
name
=
file
->
name
;
dir
.
files
[
dir
.
nr
].
changed
=
damage
;
...
...
ewah/ewah_bitmap.c
浏览文件 @
f056cde6
...
...
@@ -210,8 +210,8 @@ size_t ewah_add(struct ewah_bitmap *self, eword_t word)
void
ewah_set
(
struct
ewah_bitmap
*
self
,
size_t
i
)
{
const
size_t
dist
=
(
i
+
BITS_IN_EWORD
)
/
BITS_IN_EWORD
-
(
self
->
bit_size
+
BITS_IN_EWORD
-
1
)
/
BITS_IN_EWORD
;
DIV_ROUND_UP
(
i
+
1
,
BITS_IN_EWORD
)
-
DIV_ROUND_UP
(
self
->
bit_size
,
BITS_IN_EWORD
)
;
assert
(
i
>=
self
->
bit_size
);
...
...
imap-send.c
浏览文件 @
f056cde6
...
...
@@ -861,7 +861,7 @@ static char hexchar(unsigned int b)
return
b
<
10
?
'0'
+
b
:
'a'
+
(
b
-
10
);
}
#define ENCODED_SIZE(n) (4
*((n+2)/
3))
#define ENCODED_SIZE(n) (4
* DIV_ROUND_UP((n),
3))
static
char
*
cram
(
const
char
*
challenge_64
,
const
char
*
user
,
const
char
*
pass
)
{
int
i
,
resp_len
,
encoded_len
,
decoded_len
;
...
...
sha1_name.c
浏览文件 @
f056cde6
...
...
@@ -489,10 +489,9 @@ int find_unique_abbrev_r(char *hex, const unsigned char *sha1, int len)
* We now know we have on the order of 2^len objects, which
* expects a collision at 2^(len/2). But we also care about hex
* chars, not bits, and there are 4 bits per hex. So all
* together we need to divide by 2; but we also want to round
* odd numbers up, hence adding one before dividing.
* together we need to divide by 2 and round up.
*/
len
=
(
len
+
1
)
/
2
;
len
=
DIV_ROUND_UP
(
len
,
2
)
;
/*
* For very small repos, we stick with our regular fallback.
*/
...
...
shallow.c
浏览文件 @
f056cde6
...
...
@@ -443,7 +443,7 @@ struct paint_info {
static
uint32_t
*
paint_alloc
(
struct
paint_info
*
info
)
{
unsigned
nr
=
(
info
->
nr_bits
+
31
)
/
32
;
unsigned
nr
=
DIV_ROUND_UP
(
info
->
nr_bits
,
32
)
;
unsigned
size
=
nr
*
sizeof
(
uint32_t
);
void
*
p
;
if
(
!
info
->
pool_count
||
size
>
info
->
end
-
info
->
free
)
{
...
...
@@ -471,7 +471,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
{
unsigned
int
i
,
nr
;
struct
commit_list
*
head
=
NULL
;
int
bitmap_nr
=
(
info
->
nr_bits
+
31
)
/
32
;
int
bitmap_nr
=
DIV_ROUND_UP
(
info
->
nr_bits
,
32
)
;
size_t
bitmap_size
=
st_mult
(
sizeof
(
uint32_t
),
bitmap_nr
);
struct
commit
*
c
=
lookup_commit_reference_gently
(
oid
,
1
);
uint32_t
*
tmp
;
/* to be freed before return */
...
...
@@ -611,7 +611,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
paint_down
(
&
pi
,
ref
->
oid
+
i
,
i
);
if
(
used
)
{
int
bitmap_size
=
((
pi
.
nr_bits
+
31
)
/
32
)
*
sizeof
(
uint32_t
);
int
bitmap_size
=
DIV_ROUND_UP
(
pi
.
nr_bits
,
32
)
*
sizeof
(
uint32_t
);
memset
(
used
,
0
,
sizeof
(
*
used
)
*
info
->
shallow
->
nr
);
for
(
i
=
0
;
i
<
nr_shallow
;
i
++
)
{
const
struct
commit
*
c
=
lookup_commit
(
&
oid
[
shallow
[
i
]]);
...
...
@@ -672,7 +672,7 @@ static void post_assign_shallow(struct shallow_info *info,
struct
commit
*
c
;
uint32_t
**
bitmap
;
int
dst
,
i
,
j
;
int
bitmap_nr
=
(
info
->
ref
->
nr
+
31
)
/
32
;
int
bitmap_nr
=
DIV_ROUND_UP
(
info
->
ref
->
nr
,
32
)
;
struct
commit_array
ca
;
trace_printf_key
(
&
trace_shallow
,
"shallow: post_assign_shallow
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录