Commit Graph

5 Commits

Author SHA1 Message Date
Christopher Haster
46e22b2a38 Adopted lfs_ctz_index implementation using popcount
This reduces the O(n^2logn) runtime to read a file to only O(nlog).
The extra O(n) did not touch the disk, so it isn't a problem until the
files become very large, but this solution comes with very little cost.

Long story short, you can find the block index + offset pair for a
CTZ linked-list with this series of formulas:

n' = floor(N / (B - 2w/8))
N' = (B - 2w/8)n' + (w/8)popcount(n')
off' = N - N'
n, off =
  n'-1, off'+B                if off' <  0
  n',   off'+(w/8)(ctz(n')+1) if off' >= 0

For the long story, you will need to see the updated DESIGN.md
2017-10-18 00:44:30 -05:00
Christopher Haster
454b588f73 Updated SPEC.md and DESIGN.md based on recent changes
- Added math behind CTZ limits
- Added documentation over atomic moves
2017-10-12 20:31:33 -05:00
Christopher Haster
476915fee6 Removed a few "what"s from the documentation 2017-07-16 12:41:47 -05:00
Christopher Haster
0d66f9f991 Cleaned up design documentation 2017-06-28 15:50:29 -05:00
Christopher Haster
d2bf2bbc72 Added documentation over the underlying design 2017-05-18 23:44:18 -05:00