authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-05 19:19:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-07 00:48:32-07:00
log8dae629c4f89155b6945ee952ee2aeb5bfa1d271
tree481c61cda9711fbded6f52442c3ac95f42c3084c
parent529df8c0075a1a91860523ed33c475473d332ae3

update branch for latest std.sort changes


2 files changed, 10 insertions(+), 2 deletions(-)

lib/std/Build/Fuzz/WebServer.zig+5-1
...@@ -649,7 +649,11 @@ fn addEntryPoint(ws: *WebServer, coverage_id: u64, addr: u64) error{ AlreadyRepo...@@ -649,7 +649,11 @@ fn addEntryPoint(ws: *WebServer, coverage_id: u64, addr: u64) error{ AlreadyRepo
649 const ptr = coverage_map.mapped_memory;649 const ptr = coverage_map.mapped_memory;
650 const pcs_bytes = ptr[@sizeOf(abi.SeenPcsHeader)..][0 .. coverage_map.source_locations.len * @sizeOf(usize)];650 const pcs_bytes = ptr[@sizeOf(abi.SeenPcsHeader)..][0 .. coverage_map.source_locations.len * @sizeOf(usize)];
651 const pcs: []const usize = @alignCast(std.mem.bytesAsSlice(usize, pcs_bytes));651 const pcs: []const usize = @alignCast(std.mem.bytesAsSlice(usize, pcs_bytes));
652 const index = std.sort.upperBound(usize, addr, pcs, {}, std.sort.asc(usize));652 const index = std.sort.upperBound(usize, pcs, addr, struct {
653 fn order(context: usize, item: usize) std.math.Order {
654 return std.math.order(item, context);
655 }
656 }.order);
653 if (index >= pcs.len) {657 if (index >= pcs.len) {
654 log.err("unable to find unit test entry address 0x{x} in source locations (range: 0x{x} to 0x{x})", .{658 log.err("unable to find unit test entry address 0x{x} in source locations (range: 0x{x} to 0x{x})", .{
655 addr, pcs[0], pcs[pcs.len - 1],659 addr, pcs[0], pcs[pcs.len - 1],
lib/std/debug/Dwarf.zig+5-1
...@@ -157,7 +157,11 @@ pub const CompileUnit = struct {...@@ -157,7 +157,11 @@ pub const CompileUnit = struct {
157 };157 };
158158
159 pub fn findSource(slc: *const SrcLocCache, address: u64) !LineEntry {159 pub fn findSource(slc: *const SrcLocCache, address: u64) !LineEntry {
160 const index = std.sort.upperBound(u64, address, slc.line_table.keys(), {}, std.sort.asc(u64));160 const index = std.sort.upperBound(u64, slc.line_table.keys(), address, struct {
161 fn order(context: u64, item: u64) std.math.Order {
162 return std.math.order(item, context);
163 }
164 }.order);
161 if (index == 0) return missing();165 if (index == 0) return missing();
162 return slc.line_table.values()[index - 1];166 return slc.line_table.values()[index - 1];
163 }167 }