Merge branch 'develop' into gnb-threadpool
This commit is contained in:
+30
-1
@@ -88,12 +88,14 @@ int write_file_matlab(const char *fname,
|
||||
void *data,
|
||||
int length,
|
||||
int dec,
|
||||
char format,
|
||||
unsigned int format,
|
||||
int multiVec)
|
||||
{
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
|
||||
AssertFatal((format&~MATLAB_RAW) <16,"");
|
||||
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -110,6 +112,31 @@ int write_file_matlab(const char *fname,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ( (format&MATLAB_RAW) == MATLAB_RAW ) {
|
||||
int sz[16]={sizeof(short), 2*sizeof(short),
|
||||
sizeof(int), 2*sizeof(int),
|
||||
sizeof(char), 2*sizeof(char),
|
||||
sizeof(long long),
|
||||
sizeof(double), 2*sizeof(double),
|
||||
sizeof(unsigned char),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short)
|
||||
};
|
||||
int eltSz= sz[format&~MATLAB_RAW];
|
||||
if (dec==1)
|
||||
fwrite(data, eltSz, length, fp);
|
||||
else
|
||||
for (i=0; i<length; i+=dec)
|
||||
fwrite(data+i*eltSz, eltSz, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
@@ -215,6 +242,8 @@ int write_file_matlab(const char *fname,
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "unknown dump format: %d\n", format);
|
||||
}
|
||||
|
||||
if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
|
||||
|
||||
Reference in New Issue
Block a user