diff options
author | Determinant <ted.sybil@gmail.com> | 2016-02-24 17:26:45 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2016-02-24 17:26:45 +0800 |
commit | 550680eacd00555817df19d2b59a20a92df77c42 (patch) | |
tree | be9e39e2115fa95e99e32791898ba5593ca3b23f /nerv/lib/common.h | |
parent | e91fc2ddaa74dd2c46ce93c9e92020d66c037c8e (diff) |
clean up code
Diffstat (limited to 'nerv/lib/common.h')
-rw-r--r-- | nerv/lib/common.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nerv/lib/common.h b/nerv/lib/common.h index 3283ac1..3d98574 100644 --- a/nerv/lib/common.h +++ b/nerv/lib/common.h @@ -61,6 +61,21 @@ typedef struct Status { nerv_error_status(L, &status); \ } while (0) +#define CHECK_SAME_DIMENSION(a, b, status) \ + do { \ + if (!(a->nrow == b->nrow && a->ncol == b->ncol)) \ + NERV_EXIT_STATUS(status, MAT_MISMATCH_DIM, 0); \ + } while (0) + +#define CHECK_SAME_DIMENSION_RET(a, b, status) \ + do { \ + if (!(a->nrow == b->nrow && a->ncol == b->ncol)) \ + { \ + NERV_SET_STATUS(status, MAT_MISMATCH_DIM, 0); \ + return 0; \ + } \ + } while (0) + typedef struct HashNode { const char *key; void *val; |