From 40157a70761a8d7df699b10dc3bc92417b2861e1 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:20:40 -0500 Subject: [PATCH] Avoid branches by adding xfer_align We can avoid a branch by not comparing with 0. --- libarchive/archive_read_disk_posix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 76a4fa44de..7201d81e79 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -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);