DoxigAlpha

readBlock

Function parameters

Parameters

#
stream:*std.io.FixedBufferStream([]const u8)

Type definitions in this namespace

Types

#

Source

Implementation

#
fn readBlock(stream: *std.io.FixedBufferStream([]const u8)) ![]const u8 {
    const reader = stream.reader();
    const block_len = try leb.readUleb128(usize, reader);
    if (stream.pos + block_len > stream.buffer.len) return error.InvalidOperand;

    const block = stream.buffer[stream.pos..][0..block_len];
    reader.context.pos += block_len;

    return block;
}