Table of Contents

Struct Block

Namespace
ReFuel.Memory
Assembly
ReFuel.dll

A memory allocation block.

public readonly record struct Block : IEquatable<Block>
Implements
Inherited Members

Constructors

Block(int, int)

public Block(int head, int tail)

Parameters

head int
tail int

Fields

Empty

An empty block.

public static readonly Block Empty

Field Value

Block

Properties

Count

The number of items in this block.

public int Count { get; }

Property Value

int

Head

The start of this block.

public int Head { get; }

Property Value

int

Tail

The end of this block. Exclusive.

public int Tail { get; }

Property Value

int

Methods

Locate(Block)

public BlockLocation Locate(Block other)

Parameters

other Block

Returns

BlockLocation

TrySplit(int, out Block, out Block)

Split this block into two segments.

public bool TrySplit(int at, out Block a, out Block b)

Parameters

at int

Split at this index. Excluded in A.

a Block

The A block.

b Block

The B block.

Returns

bool

True if the split was possible.

TryUnion(out Block, in Block, in Block)

Try joining two blocks.

public static bool TryUnion(out Block result, in Block a, in Block b)

Parameters

result Block

The resulting block.

a Block

The first block.

b Block

The second block.

Returns

bool

True if the blocks were adjacent. False otherwise.

Operators

implicit operator Range(in Block)

public static implicit operator Range(in Block block)

Parameters

block Block

Returns

Range