Skip to content
Snippets Groups Projects
Commit 4f95007d authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Fixed syntax problem with namespace

parent fa94c4b2
No related branches found
No related tags found
No related merge requests found
...@@ -222,6 +222,8 @@ namespace MISCMATHS { ...@@ -222,6 +222,8 @@ namespace MISCMATHS {
// read matrix dimensions (num rows x num cols) // read matrix dimensions (num rows x num cols)
unsigned int ival,nx,ny; unsigned int ival,nx,ny;
fs.read((char*)&ival,sizeof(ival)); fs.read((char*)&ival,sizeof(ival));
// ignore the padding (reserved for future use)
fs.read((char*)&ival,sizeof(ival));
if (swapbytes) Swap_Nbytes(1,sizeof(ival),&ival); if (swapbytes) Swap_Nbytes(1,sizeof(ival),&ival);
nx = ival; nx = ival;
fs.read((char*)&ival,sizeof(ival)); fs.read((char*)&ival,sizeof(ival));
...@@ -338,6 +340,8 @@ namespace MISCMATHS { ...@@ -338,6 +340,8 @@ namespace MISCMATHS {
ival = BINFLAG; ival = BINFLAG;
fs.write((char*)&ival,sizeof(ival)); fs.write((char*)&ival,sizeof(ival));
ival = 0; // padding (reserved for future use)
fs.write((char*)&ival,sizeof(ival));
ival = mat.Nrows(); ival = mat.Nrows();
fs.write((char*)&ival,sizeof(ival)); fs.write((char*)&ival,sizeof(ival));
ival = mat.Ncols(); ival = mat.Ncols();
...@@ -1983,18 +1987,16 @@ vector<float> ColumnVector2vector(const ColumnVector& col) ...@@ -1983,18 +1987,16 @@ vector<float> ColumnVector2vector(const ColumnVector& col)
return vec; return vec;
} }
}
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
// Uninteresting byte swapping functions
typedef struct { unsigned char a,b ; } twobytes ; typedef struct { unsigned char a,b ; } TWObytes ;
void Swap_2bytes( int n , void *ar ) /* 2 bytes at a time */ void Swap_2bytes( int n , void *ar ) /* 2 bytes at a time */
{ {
register int ii ; register int ii ;
register twobytes *tb = (twobytes *)ar ; register TWObytes *tb = (TWObytes *)ar ;
register unsigned char tt ; register unsigned char tt ;
for( ii=0 ; ii < n ; ii++ ){ for( ii=0 ; ii < n ; ii++ ){
...@@ -2005,12 +2007,12 @@ void Swap_2bytes( int n , void *ar ) /* 2 bytes at a time */ ...@@ -2005,12 +2007,12 @@ void Swap_2bytes( int n , void *ar ) /* 2 bytes at a time */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct { unsigned char a,b,c,d ; } fourbytes ; typedef struct { unsigned char a,b,c,d ; } FOURbytes ;
void Swap_4bytes( int n , void *ar ) /* 4 bytes at a time */ void Swap_4bytes( int n , void *ar ) /* 4 bytes at a time */
{ {
register int ii ; register int ii ;
register fourbytes *tb = (fourbytes *)ar ; register FOURbytes *tb = (FOURbytes *)ar ;
register unsigned char tt ; register unsigned char tt ;
for( ii=0 ; ii < n ; ii++ ){ for( ii=0 ; ii < n ; ii++ ){
...@@ -2022,12 +2024,12 @@ void Swap_4bytes( int n , void *ar ) /* 4 bytes at a time */ ...@@ -2022,12 +2024,12 @@ void Swap_4bytes( int n , void *ar ) /* 4 bytes at a time */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct { unsigned char a,b,c,d , D,C,B,A ; } eightbytes ; typedef struct { unsigned char a,b,c,d , D,C,B,A ; } EIGHTbytes ;
void Swap_8bytes( int n , void *ar ) /* 8 bytes at a time */ void Swap_8bytes( int n , void *ar ) /* 8 bytes at a time */
{ {
register int ii ; register int ii ;
register eightbytes *tb = (eightbytes *)ar ; register EIGHTbytes *tb = (EIGHTbytes *)ar ;
register unsigned char tt ; register unsigned char tt ;
for( ii=0 ; ii < n ; ii++ ){ for( ii=0 ; ii < n ; ii++ ){
...@@ -2042,12 +2044,12 @@ void Swap_8bytes( int n , void *ar ) /* 8 bytes at a time */ ...@@ -2042,12 +2044,12 @@ void Swap_8bytes( int n , void *ar ) /* 8 bytes at a time */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct { unsigned char a,b,c,d,e,f,g,h , typedef struct { unsigned char a,b,c,d,e,f,g,h ,
H,G,F,E,D,C,B,A ; } sixteenbytes ; H,G,F,E,D,C,B,A ; } SIXTEENbytes ;
void Swap_16bytes( int n , void *ar ) /* 16 bytes at a time */ void Swap_16bytes( int n , void *ar ) /* 16 bytes at a time */
{ {
register int ii ; register int ii ;
register sixteenbytes *tb = (sixteenbytes *)ar ; register SIXTEENbytes *tb = (SIXTEENbytes *)ar ;
register unsigned char tt ; register unsigned char tt ;
for( ii=0 ; ii < n ; ii++ ){ for( ii=0 ; ii < n ; ii++ ){
...@@ -2076,3 +2078,6 @@ void Swap_Nbytes( int n , int siz , void *ar ) /* subsuming case */ ...@@ -2076,3 +2078,6 @@ void Swap_Nbytes( int n , int siz , void *ar ) /* subsuming case */
} }
return ; return ;
} }
// end namespace MISCMATHS
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment