Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
qbox-public
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qbox
qbox-public
Commits
2fdf0564
Commit
2fdf0564
authored
Sep 12, 2018
by
Francois Gygi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Function3d byte swapping on big endian systems
parent
f31f37e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Function3d.C
src/Function3d.C
+9
-4
No files found.
src/Function3d.C
View file @
2fdf0564
...
...
@@ -179,14 +179,19 @@ void Function3d::write(string filename) const
void
Function3d
::
print
(
ostream
&
os
)
const
{
Base64Transcoder
xcdr
;
#if PLT_BIG_ENDIAN
xcdr
.
byteswap_double
(
val
.
size
(),
&
val
[
0
]);
#endif
// transform val to base64 encoding
int
nbytes
=
val
.
size
()
*
sizeof
(
double
);
int
nchars
=
xcdr
.
nchars
(
nbytes
);
char
*
wbuf
=
new
char
[
nchars
];
#if PLT_BIG_ENDIAN
// make copy of val for byte swapping without affecting original array
vector
<
double
>
tmpval
(
val
);
xcdr
.
byteswap_double
(
tmpval
.
size
(),
&
tmpval
[
0
]);
// transform tmpval to base64 encoding
xcdr
.
encode
(
nbytes
,
(
byte
*
)
&
tmpval
[
0
],
wbuf
);
#else
// transform val to base64 encoding
xcdr
.
encode
(
nbytes
,
(
byte
*
)
&
val
[
0
],
wbuf
);
#endif
os
<<
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
<<
"<fpmd:function3d xmlns:fpmd=
\"
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment