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=855947d78e00b12e1fb34027edce9bba0d0ca0ee;p=aubio.git [aubio_priv] add AUBIO_ASSERT_EQUAL_SHAPE helper --- diff --git a/src/aubio_priv.h b/src/aubio_priv.h index 28bbaa95..019258ef 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -399,4 +399,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 */