Commit 0441ee3e authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Update bitmap to comply with non C99.

parent 6faf8f8d
Pipeline #85 passed with stage
add_library(UTIL ../defines.h common.c common.h list.c list.h dbg.h bptree.c bptree.h bitmap.c bitmap.h)
set_property(TARGET UTIL PROPERTY C_STANDARD 99)
\ No newline at end of file
set_property(TARGET UTIL PROPERTY C_STANDARD 99)
......@@ -45,8 +45,9 @@ void Bitmap_set(Bitmap *bitmap, uint32_t position, bool value)
void Bitmap_set_range(Bitmap *bitmap, uint32_t start, uint32_t length, bool value)
{
uint32_t i = 0;
// TODO: highly inefficient - optimize
for(int i = 0; i < length; i++) {
for(i = 0; i < length; i++) {
Bitmap_set(bitmap, start + i, value);
}
}
......@@ -54,8 +55,9 @@ void Bitmap_set_range(Bitmap *bitmap, uint32_t start, uint32_t length, bool valu
uint32_t Bitmap_sum_ones(Bitmap *bitmap, uint32_t start, uint32_t length)
{
uint32_t sum = 0;
uint32_t i = 0;
// TODO: highly inefficient - optimize
for(uint32_t i = 0; i < length; i++) {
for(i = 0; i < length; i++) {
sum += (Bitmap_get(bitmap, start + i) == true);
}
return sum;
......@@ -64,8 +66,9 @@ uint32_t Bitmap_sum_ones(Bitmap *bitmap, uint32_t start, uint32_t length)
uint32_t Bitmap_sum_zeros(Bitmap *bitmap, uint32_t start, uint32_t length)
{
uint32_t sum = 0;
uint32_t i = 0;
// TODO: highly inefficient - optimize
for(uint32_t i = 0; i < length; i++) {
for(i = 0; i < length; i++) {
sum += (Bitmap_get(bitmap, start + i) == false);
}
return sum;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment