Ole::Storage::AllocationTable::Big

Public Class Methods

new(*args) click to toggle source
# File lib/ole/storage/base.rb, line 564
def initialize(*args)
  super
  @block_size = 1 << @ole.header.b_shift
  @io = @ole.io
end

Public Instance Methods

blocks_to_ranges(chain, size=nil) click to toggle source

Big blocks are kind of -1 based, in order to not clash with the header.

# File lib/ole/storage/base.rb, line 571
def blocks_to_ranges chain, size=nil
  #super chain.map { |b| b + 1 }, size
  # duplicated from AllocationTable#blocks_to_ranges to avoid chain.map
  # which was decent part of benchmark profile
  chain = chain[0, (size.to_f / block_size).ceil] if size
  ranges = chain.map { |i| [block_size * (i + 1), block_size] }
  ranges.last[1] -= (ranges.length * block_size - size) if ranges.last and size
  ranges
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.