]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40302: UTF-32 encoder SWAB4() macro use a|b rather than a+b (GH-19572)
authorVictor Stinner <vstinner@python.org>
Fri, 17 Apr 2020 17:13:34 +0000 (19:13 +0200)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 17:13:34 +0000 (19:13 +0200)
Objects/stringlib/codecs.h

index 208e8fe4a48bb050b9de40d1610622f306536ce5..9b2a29ba3b8c2a739813ddbfd67ef653a9031d9f 100644 (file)
@@ -743,7 +743,7 @@ STRINGLIB(SWAB4)(STRINGLIB_CHAR ch)
     return (word << 24);
 #elif STRINGLIB_SIZEOF_CHAR == 2
     /* high bytes are zero */
-    return ((word & 0x00FFu) << 24) + ((word & 0xFF00u) << 8);
+    return ((word & 0x00FFu) << 24) | ((word & 0xFF00u) << 8);
 #else
     return _Py_bswap32(word);
 #endif