MCPcopy Create free account
hub / github.com/numpy/numpy / _buffer_info_cmp

Function _buffer_info_cmp

numpy/core/src/multiarray/buffer.c:570–591  ·  view source on GitHub ↗

Compare two info structures */

Source from the content-addressed store, hash-verified

568
569/* Compare two info structures */
570static Py_ssize_t
571_buffer_info_cmp(_buffer_info_t *a, _buffer_info_t *b)
572{
573 Py_ssize_t c;
574 int k;
575
576 if (a->format != NULL && b->format != NULL) {
577 c = strcmp(a->format, b->format);
578 if (c != 0) return c;
579 }
580 c = a->ndim - b->ndim;
581 if (c != 0) return c;
582
583 for (k = 0; k < a->ndim; ++k) {
584 c = a->shape[k] - b->shape[k];
585 if (c != 0) return c;
586 c = a->strides[k] - b->strides[k];
587 if (c != 0) return c;
588 }
589
590 return 0;
591}
592
593
594/*

Callers 1

_buffer_get_infoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected