From: Grazvydas Ignotas Date: Sat, 16 Jun 2018 18:56:13 +0000 (+0300) Subject: radeonsi: use shifts for sign extension X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e0d93dc0e4d37dff492305fb7aa6408f36ff147;p=mesa.git radeonsi: use shifts for sign extension 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 --- 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; }