From 39e1834c449a55a44e95f2cfb6b24887fd3cec70 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 24 May 2015 19:02:09 +0800 Subject: add nerv.class and try to let Lua class inherit from ParamFile --- matrix/generic/matrix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'matrix/generic/matrix.c') diff --git a/matrix/generic/matrix.c b/matrix/generic/matrix.c index b06ed89..417c534 100644 --- a/matrix/generic/matrix.c +++ b/matrix/generic/matrix.c @@ -2,6 +2,9 @@ #include "../../common.h" #include "matrix.h" +#define MATRIX_ROW_PTR(self, row) \ + (MATRIX_ELEM *)((char *)MATRIX_ELEM_PTR(self) + (row) * (self)->stride) + extern const char *nerv_matrix_(tname); extern const char *MATRIX_BASE_TNAME; @@ -49,8 +52,7 @@ static Matrix *nerv_matrix_(getrow)(Matrix *self, int row) { prow->nrow = 1; prow->stride = self->stride; prow->nmax = prow->ncol; - MATRIX_ELEM_PTR(prow) = \ - (MATRIX_ELEM *)((char *)MATRIX_ELEM_PTR(self) + row * self->stride); + MATRIX_ELEM_PTR(prow) = MATRIX_ROW_PTR(self, row); prow->data_ref = self->data_ref; nerv_matrix_(data_retain)(self); return prow; -- cgit v1.2.3