Skip to content

Commit 7458c99

Browse files
gpsheadclaude
andcommitted
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 <[email protected]>
1 parent ef38895 commit 7458c99

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/binascii.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ base64_decode_fast(const unsigned char *in, Py_ssize_t in_len,
188188
* approach; on modern pipelined CPUs this is faster than bitmask tricks
189189
* like XOR+SUB+AND for zero-detection which have data dependencies.
190190
*/
191-
if (inp[0] == '=' || inp[1] == '=' || inp[2] == '=' || inp[3] == '=') {
191+
if (inp[0] == BASE64_PAD || inp[1] == BASE64_PAD ||
192+
inp[2] == BASE64_PAD || inp[3] == BASE64_PAD) {
192193
break;
193194
}
194195

0 commit comments

Comments
 (0)