LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-19-2016, 09:32 PM   #1
hansonchar
LQ Newbie
 
Registered: May 2016
Posts: 1

Rep: Reputation: Disabled
Design of a find_prev_bit API


Hi,

To find the first set bit in a memory region at or after a given offset, there currently exists find_next_bit in the Linux Kernel API:

Code:
  int find_next_bit (const unsigned long * addr, int size, int offset);
The implementation (in Linux) of find_next_bit currently returns "size" should the "offset" argument is greater than or equal to "size".

Suppose one goes about building a

Code:
  int find_prev_bit (const unsigned long * addr, int size, int offset);
to find the first set bit in a memory region at or before a given offset, what would be the most sensible behavior should "offset" is greater than or equal to "size"?

Regards,
Hanson
 
Old 05-24-2016, 02:43 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
I would just do the search from the end of the memory region.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
openstack-nova-{compute,network,api,metadata-api} as it says pid file exists but dead Bhargavnagaraju Linux - Newbie 0 05-28-2015 05:47 PM
LXer: Secure programming with the OpenSSL API, Part 1: Overview of the API LXer Syndicated Linux News 0 06-29-2012 12:30 PM
LXer: This week at LWN: Atomic context and kernel API design LXer Syndicated Linux News 0 04-08-2008 11:41 PM
LXer: This week at LWN: LinuxConf.eu: Documentation and user-space API design LXer Syndicated Linux News 0 09-12-2007 02:40 PM
Design flaws in Win32 API Mara General 8 08-12-2002 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration