Skip to content

Commit 5f28e6b

Browse files
authored
gh-148474: Fix _Py_hexlify_simd compilation with older clang (#148475)
1 parent 5b8cd31 commit 5f28e6b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed compilation of :file:`Python/pystrhex.c` with older clang versions.

Python/pystrhex.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len)
6767
const v16u8 mask_0f = v16u8_splat(0x0f);
6868
const v16u8 ascii_0 = v16u8_splat('0');
6969
const v16u8 offset = v16u8_splat('a' - '0' - 10); /* 0x27 */
70+
const v16u8 four = v16u8_splat(4);
7071
const v16s8 nine = v16s8_splat(9);
7172

7273
Py_ssize_t i = 0;
@@ -78,7 +79,7 @@ _Py_hexlify_simd(const unsigned char *src, Py_UCS1 *dst, Py_ssize_t len)
7879
memcpy(&data, src + i, 16);
7980

8081
/* Extract high and low nibbles using vector operators */
81-
v16u8 hi = (data >> 4) & mask_0f;
82+
v16u8 hi = (data >> four) & mask_0f;
8283
v16u8 lo = data & mask_0f;
8384

8485
/* Compare > 9 using signed comparison for efficient codegen.

0 commit comments

Comments
 (0)