Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-40302: Optimize UTF-32 encoder SWAB4()
Use a | b instead of a + b in  UCS-2 implementation of SWAB4().
  • Loading branch information
vstinner committed Apr 17, 2020
commit 9388df97601d4906b0217eb9276f8a8730fd80bd
2 changes: 1 addition & 1 deletion Objects/stringlib/codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down