pgsql: Remove switch statements in vector8_shift_{left,right}.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove switch statements in vector8_shift_{left,right}.
Date: 2026-07-06 16:40:43
Message-ID: E1wgmNA-001cBU-02@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove switch statements in vector8_shift_{left,right}.

In commit ec8719ccbf, I added switch statements with all expected
shift counts to vector8_shift_{left,right} because vshlq_n_u32()
and vshrq_n_u32() require integer literals. But we can use
vshlq_u32() instead for both cases, which does not require an
integer literal, thereby avoiding the need for the switch
statements. This compiles to the same machine code on newer
versions of popular compilers.

Reviewed-by: John Naylor <johncnaylorls(at)gmail(dot)com>
Discussion: https://postgr.es/m/akWxkA-mszMm57cV%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/763ee7ea00b02592b5fb9572d77b82a1f6f052b9

Modified Files
--------------
src/include/port/simd.h | 29 +++--------------------------
1 file changed, 3 insertions(+), 26 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-07-06 17:04:31 pgsql: Prevent satisfies_hash_partition from crashing with VARIADIC NUL
Previous Message Heikki Linnakangas 2026-07-06 16:13:08 pgsql: Add comment to describe the various frontend cancel methods