From: Paul Brossier Date: Mon, 7 Jan 2019 21:51:34 +0000 (+0100) Subject: [aubio_priv] add AUBIO_ASSERT_EQUAL_SHAPE helper X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=3fa8d95f1642560d3372fed8039a2f87fb4ed7fa;p=aubio.git [aubio_priv] add AUBIO_ASSERT_EQUAL_SHAPE helper --- diff --git a/src/aubio_priv.h b/src/aubio_priv.h index 99dd299a..11ba1c4b 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -412,4 +412,12 @@ uint_t aubio_log(sint_t level, const char_t *fmt, ...); // goto to failure if condition x is not true #define AUBIO_GOTO_FAILURE(x) if (!(x)) goto failure +#define AUBIO_ASSERT_EQUAL_SHAPE(t1, t2) { \ + AUBIO_ASSERT(t1 && t2); \ + AUBIO_ASSERT(t1->ndim == t2->ndim); \ + uint_t nn; \ + for (nn = 0; nn < t1->ndim; nn++) \ + AUBIO_ASSERT(t1->shape[nn] == t2->shape[nn]); \ + } + #endif /* AUBIO_PRIV_H */