]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-148474: Fix `_Py_hexlify_simd` compilation with older clang (#148475)
authorJoshua Root <jmr@macports.org>
Thu, 16 Apr 2026 05:51:23 +0000 (15:51 +1000)
committerGitHub <noreply@github.com>
Thu, 16 Apr 2026 05:51:23 +0000 (11:21 +0530)
Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst [new file with mode: 0644]
Python/pystrhex.c

diff --git a/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst b/Misc/NEWS.d/next/Build/2026-04-12-22-54-16.gh-issue-148474.ouIO8R.rst
new file mode 100644 (file)
index 0000000..d2d2bb6
--- /dev/null
@@ -0,0 +1 @@
+Fixed compilation of :file:`Python/pystrhex.c` with older clang versions.
index 14d5719313afd2f5994920ab6e55ab25a60460e5..645bb013581288e2548eda1b35ff49fbff937912 100644 (file)
@@ -67,6 +67,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len)
     const v16u8 mask_0f = v16u8_splat(0x0f);
     const v16u8 ascii_0 = v16u8_splat('0');
     const v16u8 offset = v16u8_splat('a' - '0' - 10);  /* 0x27 */
+    const v16u8 four = v16u8_splat(4);
     const v16s8 nine = v16s8_splat(9);
 
     Py_ssize_t i = 0;
@@ -78,7 +79,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len)
         memcpy(&data, src + i, 16);
 
         /* Extract high and low nibbles using vector operators */
-        v16u8 hi = (data >> 4) & mask_0f;
+        v16u8 hi = (data >> four) & mask_0f;
         v16u8 lo = data & mask_0f;
 
         /* Compare > 9 using signed comparison for efficient codegen.