summaryrefslogtreecommitdiff
path: root/matrix/generic/matrix.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-24 19:02:09 +0800
committerDeterminant <[email protected]>2015-05-24 19:02:09 +0800
commit39e1834c449a55a44e95f2cfb6b24887fd3cec70 (patch)
tree272cbd5da6ad2208a86b2b7e6c960127b3cfecbe /matrix/generic/matrix.c
parent63b529dc50ef0fc39e9279a976ab805ea9b11de7 (diff)
add nerv.class and try to let Lua class inherit from ParamFile
Diffstat (limited to 'matrix/generic/matrix.c')
-rw-r--r--matrix/generic/matrix.c6
1 files changed, 4 insertions, 2 deletions
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;