Author Topic: Anyone come across information about optimizing this?  (Read 1404 times)

Offline Franciswalser

  • Jr. Member
  • *
  • Posts: 7
Anyone come across information about optimizing this?
« on: February 28, 2023, 11:49:53 AM »
I'm currently playing around with a 64-bit x86_64 kernel and am at the point where I need to do paging.
I've written bit arrays before in several languages but was wondering if there are more efficient ways to do
it in assembly.   It really only needs three operations:

1.  Set bit
2.  Clear bit
3.  Find first cleared bit

The set and clear bit functions are pretty straightforward, but the find first clear bit is a time hog. TellTims Survey

I've google'd for this, but keep finding information on bit masking word sized values and the like.  Plus, I'm sure
my google-fu is weak.

Anyone come across information about optimizing this?
« Last Edit: March 01, 2023, 05:35:21 AM by Franciswalser »

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 368
  • Country: br
Re: Anyone come across information about optimizing this?
« Reply #1 on: February 28, 2023, 12:39:21 PM »
See the instructions BTC, BTS, BSR and BSF.