Skip to content

Commit cb46a5d

Browse files
committed
Further plagiate git's implementation
Since j is not unsigned anymore we can reverse the table lookup loop
1 parent aaa09e1 commit cb46a5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/binascii.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,8 +1308,8 @@ binascii_b2a_base85_impl(PyObject *module, Py_buffer *data, Py_buffer *chars,
13081308
*ascii_data++ = 'y';
13091309
}
13101310
else {
1311-
for (int j = 0; j < 5 ; j++) {
1312-
ascii_data[4 - j] = table[value % 85];
1311+
for (int j = 4; j >= 0; j--) {
1312+
ascii_data[j] = table[value % 85];
13131313
value /= 85;
13141314
}
13151315
ascii_data += 5;

0 commit comments

Comments
 (0)