Hi all, hope someone can help me with an algorithm.
I have a bitmap representing available pages in a file. A
GetPage(PageCou nt) function should return the offset into the file where
PageCount of contiguous pages resides. Within the function I have a pointer
to the bitmap and want to scan the bitmap until PageCount of free bits is
found. For example assume the following bitmap is present in memory:
101011001100011 010100001111110 11001011001
If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInB itmap(4) function should return 18 (the location of 0000)
My FindFreeBitsInB itmap(BitCount) function should scan the block of memory
until it encounters BitCount of free bits. Then should return the offset
into the block where the free bits occur. There's several approaches to
this problem, can someone provide me with a very efficient algorithm to
locate the starting offset? This function resides in a DBMS and should be
very efficient as it's called very frequently. An assembler routine is also
an option. All input is greatly appreciated.
Cheers,
David
I have a bitmap representing available pages in a file. A
GetPage(PageCou nt) function should return the offset into the file where
PageCount of contiguous pages resides. Within the function I have a pointer
to the bitmap and want to scan the bitmap until PageCount of free bits is
found. For example assume the following bitmap is present in memory:
101011001100011 010100001111110 11001011001
If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInB itmap(4) function should return 18 (the location of 0000)
My FindFreeBitsInB itmap(BitCount) function should scan the block of memory
until it encounters BitCount of free bits. Then should return the offset
into the block where the free bits occur. There's several approaches to
this problem, can someone provide me with a very efficient algorithm to
locate the starting offset? This function resides in a DBMS and should be
very efficient as it's called very frequently. An assembler routine is also
an option. All input is greatly appreciated.
Cheers,
David
Comment