Skip to content

Commit

Permalink
Avoid branches by adding xfer_align
Browse files Browse the repository at this point in the history
We can avoid a branch by not comparing with 0.
  • Loading branch information
AtariDreams committed Feb 6, 2024
1 parent 60f086b commit 40157a7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libarchive/archive_read_disk_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,14 +668,12 @@ setup_suitable_read_buffer(struct archive_read_disk *a)
*/
s = (uintptr_t)cf->allocation_ptr;
s %= xfer_align;
if (s > 0)
s = xfer_align - s;

/*
* Set a read buffer pointer in the proper alignment of
* the current filesystem.
*/
cf->buff = cf->allocation_ptr + s;
cf->buff = cf->allocation_ptr + xfer_align - s;
cf->buff_size = asize - xfer_align;
}
return (ARCHIVE_OK);
Expand Down

0 comments on commit 40157a7

Please sign in to comment.