Merge pull request #36 from d3m3vilurr/refix-alloca

Add NEED_ALLOCA macro
This commit is contained in:
Cameron Gutman 2018-07-21 12:19:42 -07:00 committed by GitHub
commit dabf0e9c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,7 @@
#include "rs.h"
#ifdef _MSC_VER
#define NEED_ALLOCA
#define alloca(x) _alloca(x)
#endif
@ -225,10 +226,17 @@ static int invert_mat(gf *src, int k) {
int irow, icol, row, col, i, ix;
int error = 1;
#ifdef NEED_ALLOCA
int *indxc = alloca(k*sizeof(int));
int *indxr = alloca(k*sizeof(int));
int *ipiv = alloca(k*sizeof(int));
gf *id_row = alloca(k*sizeof(gf));
#else
int indxc[k];
int indxr[k];
int ipiv[k];
gf id_row[k];
#endif
memset(id_row, 0, k*sizeof(gf));
/*