Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
8a2d0f48
Commit
8a2d0f48
authored
Jun 02, 2011
by
csharptest
Committed by
rogerk
Jun 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
big-endian support for float, and double on Silverlight
parent
27bfcc5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
CodedOutputStream.cs
src/ProtocolBuffers/CodedOutputStream.cs
+8
-7
No files found.
src/ProtocolBuffers/CodedOutputStream.cs
View file @
8a2d0f48
...
...
@@ -446,12 +446,13 @@ namespace Google.ProtocolBuffers
/// </summary>
public
void
WriteDoubleNoTag
(
double
value
)
{
// TODO(jonskeet): Test this on different endiannesses
#if SILVERLIGHT2 || COMPACT_FRAMEWORK_35
byte
[]
bytes
=
BitConverter
.
GetBytes
(
value
);
WriteRawBytes
(
bytes
,
0
,
8
);
byte
[]
rawBytes
=
BitConverter
.
GetBytes
(
value
);
if
(!
BitConverter
.
IsLittleEndian
)
Array
.
Reverse
(
rawBytes
);
WriteRawBytes
(
rawBytes
,
0
,
8
);
#else
WriteRawLittleEndian64
((
ulong
)
BitConverter
.
DoubleToInt64Bits
(
value
));
WriteRawLittleEndian64
((
ulong
)
BitConverter
.
DoubleToInt64Bits
(
value
));
#endif
}
...
...
@@ -460,10 +461,10 @@ namespace Google.ProtocolBuffers
/// </summary>
public
void
WriteFloatNoTag
(
float
value
)
{
// TODO(jonskeet): Test this on different endiannesses
byte
[]
rawBytes
=
BitConverter
.
GetBytes
(
value
);
uint
asInteger
=
BitConverter
.
ToUInt32
(
rawBytes
,
0
);
WriteRawLittleEndian32
(
asInteger
);
if
(!
BitConverter
.
IsLittleEndian
)
Array
.
Reverse
(
rawBytes
);
WriteRawBytes
(
rawBytes
,
0
,
4
);
}
/// <summary>
...
...
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