Skip to content

Commit

Permalink
macho: backport fixed chunk size when calculating UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 8, 2024
1 parent 788dfa2 commit 758571c
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 758571c

Please sign in to comment.