Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use BASE64_PAD macro instead of literal '=' in fast path
Replace hardcoded '=' characters with the BASE64_PAD macro
for consistency with the rest of the codebase.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
  • Loading branch information
gpshead and claude committed Dec 29, 2025
commit 7458c99764b5d590282f126d868c25e11ec0cada
3 changes: 2 additions & 1 deletion Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ base64_decode_fast(const unsigned char *in, Py_ssize_t in_len,
* approach; on modern pipelined CPUs this is faster than bitmask tricks
* like XOR+SUB+AND for zero-detection which have data dependencies.
*/
if (inp[0] == '=' || inp[1] == '=' || inp[2] == '=' || inp[3] == '=') {
if (inp[0] == BASE64_PAD || inp[1] == BASE64_PAD ||
inp[2] == BASE64_PAD || inp[3] == BASE64_PAD) {
break;
}

Expand Down
Loading