Skip to content

Commit b2365ed

Browse files
committed
fix bitmap space not decrease bug
1 parent 5e4ecde commit b2365ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zh-hans/basics_algorithm/bitmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
3232
{
3333
const int BIT_LEN = sizeof(int) * 8;
3434
const unsigned int N = 1 << (BIT_LEN - 1);
35-
unsigned int *bits = (unsigned int *)calloc(N, sizeof(int));
35+
unsigned int *bits = (unsigned int *)calloc(N / BIT_LEN, sizeof(int));
3636
for (unsigned int i = 0; i < N; i++) {
3737
if (i % 10000001 == 0) setbit(bits, i, BIT_LEN);
3838
}

0 commit comments

Comments
 (0)