From 855947d78e00b12e1fb34027edce9bba0d0ca0ee Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 7 Jan 2019 22:51:34 +0100 Subject: [PATCH] [aubio_priv] add AUBIO_ASSERT_EQUAL_SHAPE helper --- src/aubio_priv.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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 */ -- 2.11.0