unionstd.Target.Query.CpuModel[src]

Fields

native

Always native

baseline

Always baseline

determined_by_arch_os

If CPU Architecture is native, then the CPU model will be native. Otherwise, it will be baseline.

explicit: *const Target.Cpu.Model

Functions

Functioneql[src]

pub fn eql(a: CpuModel, b: CpuModel) bool

Parameters

Source Code

Source code
pub fn eql(a: CpuModel, b: CpuModel) bool {
    const Tag = @typeInfo(CpuModel).@"union".tag_type.?;
    const a_tag: Tag = a;
    const b_tag: Tag = b;
    if (a_tag != b_tag) return false;
    return switch (a) {
        .native, .baseline, .determined_by_arch_os => true,
        .explicit => |a_model| a_model == b.explicit,
    };
}

Source Code

Source code
pub const CpuModel = union(enum) {
    /// Always native
    native,

    /// Always baseline
    baseline,

    /// If CPU Architecture is native, then the CPU model will be native. Otherwise,
    /// it will be baseline.
    determined_by_arch_os,

    explicit: *const Target.Cpu.Model,

    pub fn eql(a: CpuModel, b: CpuModel) bool {
        const Tag = @typeInfo(CpuModel).@"union".tag_type.?;
        const a_tag: Tag = a;
        const b_tag: Tag = b;
        if (a_tag != b_tag) return false;
        return switch (a) {
            .native, .baseline, .determined_by_arch_os => true,
            .explicit => |a_model| a_model == b.explicit,
        };
    }
}