Skip to content

Commit

Permalink
Merge pull request #100 from kubkon/macho-fixes-2
Browse files Browse the repository at this point in the history
macho+test: misc fixes
  • Loading branch information
kubkon authored Jan 8, 2024
2 parents b8efe50 + 977726e commit 6d722e8
Show file tree
Hide file tree
Showing 5 changed files with 959 additions and 1,017 deletions.
3 changes: 2 additions & 1 deletion src/MachO/InternalObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub fn addSymbol(self: *InternalObject, name: [:0]const u8, macho_file: *MachO)
const off = try macho_file.string_intern.insert(gpa, name);
const gop = try macho_file.getOrCreateGlobal(off);
self.symbols.addOneAssumeCapacity().* = gop.index;
macho_file.getSymbol(gop.index).file = self.index;
const sym = macho_file.getSymbol(gop.index);
sym.* = .{ .name = off, .file = self.index };
return gop.index;
}

Expand Down
6 changes: 3 additions & 3 deletions src/MachO/uuid.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ pub fn calcUuid(
const tracy = trace(@src());
defer tracy.end();

const num_chunks = thread_pool.threads.len * 0x10;
const chunk_size = @divTrunc(file_size, num_chunks);
const actual_num_chunks = if (@rem(file_size, num_chunks) > 0) num_chunks + 1 else num_chunks;
const chunk_size: usize = 1024 * 1024;
const num_chunks: usize = std.math.cast(usize, @divTrunc(file_size, chunk_size)) orelse return error.Overflow;
const actual_num_chunks = if (@rem(file_size, chunk_size) > 0) num_chunks + 1 else num_chunks;

const hashes = try allocator.alloc([Md5.digest_length]u8, actual_num_chunks);
defer allocator.free(hashes);
Expand Down
Loading

0 comments on commit 6d722e8

Please sign in to comment.