Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
miscmaths
Commits
4f95007d
Commit
4f95007d
authored
19 years ago
by
Mark Jenkinson
Browse files
Options
Downloads
Patches
Plain Diff
Fixed syntax problem with namespace
parent
fa94c4b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
miscmaths.cc
+16
-11
16 additions, 11 deletions
miscmaths.cc
with
16 additions
and
11 deletions
miscmaths.cc
+
16
−
11
View file @
4f95007d
...
@@ -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
;
}
two
bytes
;
typedef
struct
{
unsigned
char
a
,
b
;
}
TWO
bytes
;
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
two
bytes
*
tb
=
(
two
bytes
*
)
ar
;
register
TWO
bytes
*
tb
=
(
TWO
bytes
*
)
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
;
}
four
bytes
;
typedef
struct
{
unsigned
char
a
,
b
,
c
,
d
;
}
FOUR
bytes
;
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
four
bytes
*
tb
=
(
four
bytes
*
)
ar
;
register
FOUR
bytes
*
tb
=
(
FOUR
bytes
*
)
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
;
}
eight
bytes
;
typedef
struct
{
unsigned
char
a
,
b
,
c
,
d
,
D
,
C
,
B
,
A
;
}
EIGHT
bytes
;
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
eight
bytes
*
tb
=
(
eight
bytes
*
)
ar
;
register
EIGHT
bytes
*
tb
=
(
EIGHT
bytes
*
)
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
;
}
sixteen
bytes
;
H
,
G
,
F
,
E
,
D
,
C
,
B
,
A
;
}
SIXTEEN
bytes
;
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
sixteen
bytes
*
tb
=
(
sixteen
bytes
*
)
ar
;
register
SIXTEEN
bytes
*
tb
=
(
SIXTEEN
bytes
*
)
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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment