| ... | ... | @@ -399,14 +399,14 @@ test "detect" { |
| 399 | 399 | |
| 400 | 400 | pub fn detectNativeCpuAndFeatures() ?Target.Cpu { |
| 401 | 401 | var cpu_family: std.c.CPUFAMILY = undefined; |
| 402 | | var len: usize = @sizeOf(std.c.CPUFAMILY); |
| 402 | var len: usize = @sizeOf(@TypeOf(cpu_family)); |
| 403 | 403 | switch (posix.errno(posix.system.sysctlbyname("hw.cpufamily", &cpu_family, &len, null, 0))) { |
| 404 | 404 | .SUCCESS => {}, |
| 405 | 405 | .FAULT => unreachable, // segmentation fault |
| 406 | 406 | .PERM => unreachable, // only when setting values, |
| 407 | 407 | .NOMEM => unreachable, // memory already on the stack |
| 408 | 408 | .NOENT => unreachable, // constant, known good value |
| 409 | | else => unreachable, |
| 409 | else => return null, |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | const current_arch = builtin.cpu.arch; |
| ... | ... | @@ -438,11 +438,7 @@ pub fn detectNativeCpuAndFeatures() ?Target.Cpu { |
| 438 | 438 | else => return null, |
| 439 | 439 | }; |
| 440 | 440 | |
| 441 | | return Target.Cpu{ |
| 442 | | .arch = current_arch, |
| 443 | | .model = model, |
| 444 | | .features = model.features, |
| 445 | | }; |
| 441 | return model.toCpu(current_arch); |
| 446 | 442 | }, |
| 447 | 443 | else => {}, |
| 448 | 444 | } |