比特测试 [英] Bit testing

查看:75
本文介绍了比特测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,希望有人可以帮我算法。


我有一个位图来表示文件中的可用页面。一个

GetPage(PageCount)函数应该将偏移量返回到

PageCount的连续页面所在的文件中。在函数中,我有一个指针

到位图,并希望扫描位图,直到PageCount的空闲位是找到
。例如假设内存中存在以下位图:


10101100110001101010000111111011001011001

如果我想检索4位空闲的偏移量,

FindFreeBitsInBitmap(4)函数应返回18(0000的位置)


我的FindFreeBitsInBitmap(BitCount)函数应扫描内存块

,直到它遇到BitCount的空闲位。然后应将偏移量

返回到发生空闲位的块中。有几种方法来解决这个问题,有人能为我提供一个非常有效的算法吗?
找到起始偏移量?这个函数驻留在DBMS中,并且应该非常有效,因为它经常被调用。汇编程序例程也是一个选项。非常感谢所有投入。


干杯,

David

Hi all, hope someone can help me with an algorithm.

I have a bitmap representing available pages in a file. A
GetPage(PageCount) 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:

10101100110001101010000111111011001011001

If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInBitmap(4) function should return 18 (the location of 0000)

My FindFreeBitsInBitmap(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

推荐答案

David Mott写道:
David Mott wrote:
大家好,希望有人可以帮我算法。

我有一个位图来表示文件中的可用页面。 GetPage(PageCount)函数应该将偏移量返回到
PageCount的连续页面所在的文件中。在函数中我有一个指向位图的指针,想要扫描位图,直到找到PageCount的空闲位。例如,假设内存中存在以下位图:

10101100110001101010000111111011001011001

如果我想检索4位可用的偏移量,那么
FindFreeBitsInBitmap(4)函数应返回18(0000的位置)

我的FindFreeBitsInBitmap(BitCount)函数应扫描内存块,直到它遇到BitCount的空闲位。然后应将偏移量
返回到空闲位发生的块中。有几种解决这个问题的方法,有人能为我提供一个非常有效的算法来定位起始偏移吗?此功能驻留在DBMS中,并且应该非常有效,因为它经常被调用。汇编程序也是一种选择。非常感谢所有的输入。
Hi all, hope someone can help me with an algorithm.

I have a bitmap representing available pages in a file. A
GetPage(PageCount) 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:

10101100110001101010000111111011001011001

If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInBitmap(4) function should return 18 (the location of 0000)

My FindFreeBitsInBitmap(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.




这是关于comp.lang.c ++的偏离主题,因为

中没有具体的问题你的问题C ++ - 尝试comp.programming或算法组。



This is off-topic on comp.lang.c++ since there is nothing specific in
your question about C++ - try comp.programming or an algorithms group.





" Gianni Mariani" < GI ******* @ mariani.ws>在消息中写道

news:bu ******** @ dispatch.concentric.net ...


"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:bu********@dispatch.concentric.net...
David Mott写道:
David Mott wrote:
大家好,希望有人可以帮我一个算法。

我有一个位图表示文件中的可用页面。 GetPage(PageCount)函数应该将偏移量返回到
PageCount的连续页面所在的文件中。在函数中,我有一个
指向位图的指针,想要扫描位图,直到找到PageCount的空闲位
。例如,假设内存中存在以下位图:

10101100110001101010000111111011001011001

如果我想检索4位可用的偏移量,那么
FindFreeBitsInBitmap(4)函数应返回18(0000的位置)

我的FindFreeBitsInBitmap(BitCount)函数应扫描
内存块,直到它遇到BitCount的空闲位。然后应该将
偏移量返回到发生空闲位的块中。有几种解决这个问题的方法,有人能为我提供一个非常有效的算法来定位起始偏移吗?这个函数驻留在DBMS中,并且
非常有效,因为它经常被调用。汇编程序例程是
也是一个选项。非常感谢所有输入。
Hi all, hope someone can help me with an algorithm.

I have a bitmap representing available pages in a file. A
GetPage(PageCount) 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:

10101100110001101010000111111011001011001

If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInBitmap(4) function should return 18 (the location of 0000)

My FindFreeBitsInBitmap(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.



这是关于comp.lang.c ++的偏离主题,因为关于C ++的问题没有具体的内容 - 尝试comp.programming或者算法组。



This is off-topic on comp.lang.c++ since there is nothing specific in
your question about C++ - try comp.programming or an algorithms group.




白痴,当然它不是C ++独有的,算法可以是任何类型,包括
C ++。如果你有c / c ++算法,那么发布它。如果没有,请不要将b $ b变成愚蠢的屁股并保持安静。



Idiot, of course it''s not C++ exclusive, the algorithm could be of any type,
C++ included. If you have a c/c++ algorithm, then post it. If not, don''t
be a stupid ass and keep quiet.


" David Mott" < DM *** @ austin.rr.not.home.com>在消息中写道

新闻:Qc ***************** @ fe1.texas.rr.com ...
"David Mott" <dm***@austin.rr.not.home.com> wrote in message
news:Qc*****************@fe1.texas.rr.com...

Gianni Mariani < GI ******* @ mariani.ws>在消息中写道
新闻:bu ******** @ dispatch.concentric.net ...

"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:bu********@dispatch.concentric.net...
David Mott写道:

这是关闭的comp.lang.c ++上的-topic,因为在你关于C ++的问题中没有特定的
- 尝试comp.programming或算法
David Mott wrote:

This is off-topic on comp.lang.c++ since there is nothing specific in your question about C++ - try comp.programming or an algorithms


group。
白痴当然是'不是C ++独有的,算法可以是
任何类型,包括C ++。如果你有c / c ++算法,那么发布它。如果没有,
不是一个愚蠢的屁股并保持安静。

group.
Idiot, of course it''s not C++ exclusive, the algorithm could be of any type, C++ included. If you have a c/c++ algorithm, then post it. If not, don''t be a stupid ass and keep quiet.




这可能不是主题,但你真的希望有人回答

你现在的问题是什么?


Jonathan



It may not be off topic, but do you really expect anyone to answer
your question now?

Jonathan


这篇关于比特测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆