authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-29 18:31:03+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-29 18:31:03+01:00
log278f0f8fa97610589dfb28c8fffedca7298e6715
tree8401028f7f8e6bae08ca457f31e876c4b74b4953
parent58222204353c052a62f3723f879dc16f2d608f8b

Change how the build-id is checked

Address review comment by @rocksnest

1 files changed, 5 insertions(+), 5 deletions(-)

lib/std/zig/system.zig+5-5
...@@ -239,7 +239,7 @@ pub const NativeTargetInfo = struct {...@@ -239,7 +239,7 @@ pub const NativeTargetInfo = struct {
239 @intCast(u16, version_info.dwMajorVersion & 0xff) << 8 |239 @intCast(u16, version_info.dwMajorVersion & 0xff) << 8 |
240 @intCast(u16, version_info.dwMinorVersion & 0xff);240 @intCast(u16, version_info.dwMinorVersion & 0xff);
241 const sp_ver: u8 = 0;241 const sp_ver: u8 = 0;
242 const sub_ver: u8 = if (os_ver >= 0xA000) subver: {242 const sub_ver: u8 = if (os_ver >= 0x0A00) subver: {
243 // There's no other way to obtain this info beside243 // There's no other way to obtain this info beside
244 // checking the build number against a known set of244 // checking the build number against a known set of
245 // values245 // values
...@@ -247,12 +247,12 @@ pub const NativeTargetInfo = struct {...@@ -247,12 +247,12 @@ pub const NativeTargetInfo = struct {
247 10240, 10586, 14393, 15063, 16299, 17134, 17763,247 10240, 10586, 14393, 15063, 16299, 17134, 17763,
248 18362, 18363,248 18362, 18363,
249 };249 };
250 var last_idx: usize = 0;
250 for (known_build_numbers) |build, i| {251 for (known_build_numbers) |build, i| {
251 if (version_info.dwBuildNumber < build)252 if (version_info.dwBuildNumber >= build)
252 break :subver @truncate(u8, i);253 last_idx = i;
253 }254 }
254 // Unknown subversion, the OS is too new...255 break :subver @truncate(u8, last_idx);
255 break :subver @truncate(u8, known_build_numbers.len);
256 } else 0;256 } else 0;
257257
258 const version: u32 = @as(u32, os_ver) << 16 | @as(u32, sp_ver) << 8 | sub_ver;258 const version: u32 = @as(u32, os_ver) << 16 | @as(u32, sp_ver) << 8 | sub_ver;