-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitmap_test.c
More file actions
28 lines (27 loc) · 749 Bytes
/
bitmap_test.c
File metadata and controls
28 lines (27 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <string.h>
#include <stdio.h>
#include "bitmap.h"
int main(int argc, char const *argv[])
{
struct bitmap* bitmap = init_bm(64);
print_bitmap(bitmap, 64);
printf("Next Free: %u\n", next_free_page(bitmap));
for(int i = 0; i < 64; i++){
use_page(bitmap, i);
}
print_bitmap(bitmap, 64);
printf("Next Free: %u\n", next_free_page(bitmap));
for(int i = 10; i < 50; i++){
free_page(bitmap, i);
}
for(int i = 2; i < 5; i++){
free_page(bitmap, i);
}
for(int i = 15; i < 41; i++){
use_page(bitmap, i);
}
print_bitmap(bitmap, 64);
printf("Next Free: %u\n", next_free_page(bitmap));
printf("Next Free: %u\n", next_n_free_pages(bitmap, 1));
return 0;
}