Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Struct

S390xCpuinfoImpl

Private Struct
std.zig.system.linux.S390xCpuinfoImpl
const S390xCpuinfoImpl = struct

Fields

model: ?*const Target.Cpu.Model = null

Values

Functions

fn line_hook(self: *S390xCpuinfoImpl, key: []const u8, value: []const u8) !bool
fn finalize(self: *const S390xCpuinfoImpl, arch: Target.Cpu.Arch) ?Target.Cpu

File

zig/system/linux.zig:195
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
const S390xCpuinfoImpl = struct {
    model: ?*const Target.Cpu.Model = null,

    const cpu_names = .{
        // z900: 2064, 2066
        // z990: 2084, 2086
        // z9: 2094, 2096

        .{ "2097", &Target.s390x.cpu.z10 },
        .{ "2098", &Target.s390x.cpu.z10 },
        .{ "2817", &Target.s390x.cpu.z196 },
        .{ "2818", &Target.s390x.cpu.z196 },
        .{ "2827", &Target.s390x.cpu.zEC12 },
        .{ "2828", &Target.s390x.cpu.zEC12 },
        .{ "2964", &Target.s390x.cpu.z13 },
        .{ "2965", &Target.s390x.cpu.z13 },
        .{ "3906", &Target.s390x.cpu.z14 },
        .{ "3907", &Target.s390x.cpu.z14 },
        .{ "8561", &Target.s390x.cpu.z15 },
        .{ "8562", &Target.s390x.cpu.z15 },
        .{ "3931", &Target.s390x.cpu.z16 },
        .{ "3932", &Target.s390x.cpu.z16 },
        .{ "9175", &Target.s390x.cpu.z17 },
        .{ "9176", &Target.s390x.cpu.z17 },
    };

    fn line_hook(self: *S390xCpuinfoImpl, key: []const u8, value: []const u8) !bool {
        if (mem.eql(u8, key, "machine")) {
            inline for (cpu_names) |pair| {
                if (mem.eql(u8, value, pair[0])) {
                    self.model = pair[1];
                    break;
                }
            }

            return false;
        }

        return true;
    }

    fn finalize(self: *const S390xCpuinfoImpl, arch: Target.Cpu.Arch) ?Target.Cpu {
        const model = self.model orelse return null;
        return Target.Cpu{
            .arch = arch,
            .model = model,
            .features = model.features,
        };
    }
}