From 4e0d93dc0e4d37dff492305fb7aa6408f36ff147 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sat, 16 Jun 2018 21:56:13 +0300 Subject: [PATCH] radeonsi: use shifts for sign extension MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Avoids a branch and reduces code size a tiny bit: text data bss dec hex filename 10804563 398653 2070368 13273584 ca89f0 /tmp/radeonsi_dri.so.old 10804499 398653 2070368 13273520 ca89b0 /tmp/radeonsi_dri.so Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_descriptors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index d3da8a470a4..9de0112878e 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -100,8 +100,8 @@ static uint64_t si_desc_extract_buffer_address(const uint32_t *desc) ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32); /* Sign-extend the 48-bit address. */ - if (va & (1ull << 47)) - va |= 0xffffull << 48; + va <<= 16; + va = (int64_t)va >> 16; return va; } -- 2.30.2