Skip to documentation
SLOP

tiny.smt.ModelValue

Reference tiny.smt ModelValue

Defined in bitvec.

The value of a constant, a function argument or a function result in a model: a Boolean, a bit-vector or an array, for code that reads one from a Model to print it or compare it with an expected value.

API (5)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsbitvecModelValue
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/smt/src/bitvec.zig:111

zig
/// The value of a constant, a function argument or a function result in a model: a Boolean, a/// bit-vector or an array, for code that reads one from a `Model` to print it or compare it with an/// expected value. A value that holds an array owns its cells, so its owner calls `deinit`.pub const ModelValue = union(enum) {    /// A Boolean value.    bool: bool,    /// A bit-vector value: its bits as an unsigned number, least significant bit as bit 0, and its    /// width.    bitvec: struct {        value: u128,        width: u32,    },    /// An array value: its index width, its element width and one number per cell, the cell for    /// index i at position i. The cells are a slice the value owns.    array: struct {        index_width: u32,        element_width: u32,        cells: []u128,    },    /// Frees an array value's cells with `allocator`, which has to be the allocator that made them,    /// for a caller that holds a value outside a `Model`. The function frees nothing for a Boolean    /// or a bit-vector.    pub fn deinit(self: *ModelValue, allocator: std.mem.Allocator) void {        switch (self.*) {            .array => |array| allocator.free(array.cells),            else => {},        }        self.* = undefined;    }    /// Writes the value in SMT-LIB syntax: `true` or `false`, `(_ bvV W)`, or an array as    /// `(array (_ BitVec i) (_ BitVec e) 0->(_ bvV e) ...)` with one index and value per cell, for    /// `Model.write` to call for every value. The function returns only the writer's errors.    pub fn write(self: ModelValue, writer: *std.Io.Writer) std.Io.Writer.Error!void {        switch (self) {            .bool => |value| try writer.writeAll(if (value) "true" else "false"),            .bitvec => |value| try writer.print("(_ bv{d} {d})", .{ value.value, value.width }),            .array => |value| {                try writer.print("(array (_ BitVec {d}) (_ BitVec {d})", .{ value.index_width, value.element_width });                for (value.cells, 0..) |cell, index| {                    try writer.print(" {d}->(_ bv{d} {d})", .{ index, cell, value.element_width });                }                try writer.writeAll(")");            },        }    }};

Source: lib/smt/src/root.zig:122

zig
pub const ModelValue = bitvec.ModelValue;
Called byCallsNo direct callsbitvec.FunctionModelEntrydeinitModelValuedeinit
Static calls · unresolved targets: 0 · external targets: 1.

Audit

Definitions3
Public names6
Members3
Version26.7.0
Revisiondaab053ee433