[haiku-development] Re: BFS code questions

  • From: Janito Ferreira Filho <jvffprog@xxxxxxxxxxx>
  • To: Haiku Development <haiku-development@xxxxxxxxxxxxx>
  • Date: Tue, 6 Apr 2010 20:21:30 +0000

> axeld@xxxxxxxxxxxxxxxx wrote:
> Exactly, just that "start" is in blocks, not bytes.


I think I got it now. Dividing "start" by the number of bits in a block 
(BlockSize() << 3) we have the block that contains the start bit. And doing 
"start" % number of bytes in a block, we have the byte that contains the start 
bit. What I still don't understand is why we calculate the "group" that way. 
Shouldn't it be (block that contains the start bit) / (number of blocks in an 
allocation group)? And the remainder be the actual "groupBlock"? Also, the 
AllocationGroupShift() returns the log2 of the number of blocks or bytes in an 
allocation group? (I assume it's blocks =)

> No problem - better one time too often than living with a bug just 
> because you didn't mention something; usually it hints to code that 
> could receive some refactoring in order to make it clearer to 
> understand, at the very least :-)

If you want, I could comment the lines to explain the calculations. Thanks for 
your help, =)

Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

Other related posts: