提交 1d4292bf 编写于 作者: J Jia He 提交者: Dave Chinner

libxfs: Optimize the loop for xfs_bitmap_empty

If there is any non zero bit in a long bitmap, it can jump out of the
loop and finish the function as soon as possible.
Signed-off-by: NJia He <hejianet@gmail.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 16830985
...@@ -32,13 +32,13 @@ int ...@@ -32,13 +32,13 @@ int
xfs_bitmap_empty(uint *map, uint size) xfs_bitmap_empty(uint *map, uint size)
{ {
uint i; uint i;
uint ret = 0;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
ret |= map[i]; if (map[i] != 0)
return 0;
} }
return (ret == 0); return 1;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册