Skip to content

Commit b42914c

Browse files
committed
memcmp
1 parent 4ec6eb0 commit b42914c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎Objects/memoryobject.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,6 +3444,11 @@ cmp_base(const char *p, const char *q, const Py_ssize_t *shape,
34443444
Py_ssize_t i;
34453445
int equal;
34463446

3447+
if ((*fmt == 'B' || *fmt == 'b' || *fmt == 'c') &&
3448+
pstrides[0] == 1 && qstrides[0] == 1 &&
3449+
psuboffsets == NULL && qsuboffsets == NULL && shape[0] > 0) {
3450+
return memcmp(p, q, shape[0]) == 0;
3451+
}
34473452
for (i = 0; i < shape[0]; p+=pstrides[0], q+=qstrides[0], i++) {
34483453
const char *xp = ADJUST_PTR(p, psuboffsets, 0);
34493454
const char *xq = ADJUST_PTR(q, qsuboffsets, 0);

0 commit comments

Comments
 (0)