[php-src] master: ext/standard: Remove redundant if-branch in rot13 (#23795)

From: Date: Tue, 29 Sep 2026 16:02:39 +0000
Subject: [php-src] master: ext/standard: Remove redundant if-branch in rot13 (#23795)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141693@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Committer: GitHub (web-flow) Pusher: LamentXU123 Date: 2026-09-30T00:02:36+08:00 Commit: https://github.com/php/php-src/commit/68301c0df82c31a1e1f8edac42123695f0850033 Raw diff: https://github.com/php/php-src/commit/68301c0df82c31a1e1f8edac42123695f0850033.diff ext/standard: Remove redundant if-branch in rot13 (#23795) Changed paths: M UPGRADING M ext/standard/string.c Diff: diff --git a/UPGRADING b/UPGRADING index 27dc06f12d2e..10994928470a 100644 --- a/UPGRADING +++ b/UPGRADING @@ -84,3 +84,4 @@ PHP 8.7 UPGRADE NOTES - Standard: . Improved performance of array_splice() when inserting without removing elements. + . Improved performance of str_rot13(). diff --git a/ext/standard/string.c b/ext/standard/string.c index ddd3f31bf14f..d23c117321a4 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -6054,34 +6054,26 @@ static zend_string *php_str_rot13(zend_string *str) gt = _mm_cmpgt_epi8(in, a_minus_1); lt = _mm_cmplt_epi8(in, m_plus_1); cmp = _mm_and_si128(lt, gt); - if (_mm_movemask_epi8(cmp)) { - cmp = _mm_and_si128(cmp, add); - delta = _mm_or_si128(delta, cmp); - } + cmp = _mm_and_si128(cmp, add); + delta = _mm_or_si128(delta, cmp); gt = _mm_cmpgt_epi8(in, n_minus_1); lt = _mm_cmplt_epi8(in, z_plus_1); cmp = _mm_and_si128(lt, gt); - if (_mm_movemask_epi8(cmp)) { - cmp = _mm_and_si128(cmp, sub); - delta = _mm_or_si128(delta, cmp); - } + cmp = _mm_and_si128(cmp, sub); + delta = _mm_or_si128(delta, cmp); gt = _mm_cmpgt_epi8(in, A_minus_1); lt = _mm_cmplt_epi8(in, M_plus_1); cmp = _mm_and_si128(lt, gt); - if (_mm_movemask_epi8(cmp)) { - cmp = _mm_and_si128(cmp, add); - delta = _mm_or_si128(delta, cmp); - } + cmp = _mm_and_si128(cmp, add); + delta = _mm_or_si128(delta, cmp); gt = _mm_cmpgt_epi8(in, N_minus_1); lt = _mm_cmplt_epi8(in, Z_plus_1); cmp = _mm_and_si128(lt, gt); - if (_mm_movemask_epi8(cmp)) { - cmp = _mm_and_si128(cmp, sub); - delta = _mm_or_si128(delta, cmp); - } + cmp = _mm_and_si128(cmp, sub); + delta = _mm_or_si128(delta, cmp); in = _mm_add_epi8(in, delta); _mm_storeu_si128((__m128i *)target, in);

« previous php.cvs (#141693) next »