public Heap(Block block) { _block = block; _mapOffset = BitConverter.ToUInt16(_block.Data, 0); _allocations = new ushort[AllocatedCount + 1]; for (var i = 0; i < AllocatedCount + 1; i++) _allocations[i] = BitConverter.ToUInt16(_block.Data, _mapOffset + 4 + i * 2); }
private SiEntry FindIntermediateEntry(Block block, Nid nid) { var numEntries = BitConverter.ToUInt16(block.Data, 2); for (int i = 0; i < numEntries; i++) { var entryNid = BitConverter.ToUInt32(block.Data, 8 + i * 16); if (entryNid > nid) { return new SiEntry { Nid = BitConverter.ToUInt32(block.Data, 8 + (i - 1) * 16), Bid = BitConverter.ToUInt64(block.Data, 16 + (i - 1) * 16) }; } } return null; }
private SlEntry FindLeafEntry(Block block, Nid nid) { var numEntries = BitConverter.ToUInt16(block.Data, 2); for (int i = 0; i < numEntries; i++) { var entryNid = BitConverter.ToUInt32(block.Data, 8 + i * 24); if (entryNid == nid) { return new SlEntry { Nid = BitConverter.ToUInt32(block.Data, 8 + i * 24), DataBid = BitConverter.ToUInt64(block.Data, 16 + i * 24), SubnodeBid = BitConverter.ToUInt64(block.Data, 24 + i * 24) }; } } return null; }