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
695715ad
Commit
695715ad
authored
May 08, 2015
by
Jeff Davidson
Committed by
Brian Duff
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up little endian int/long writes.
Bug: 20636336 Change-Id: I303d712967f9885f7c3082d00f961f8ab93a6aed
parent
cd141089
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
CodedOutputByteBufferNano.java
...a/com/google/protobuf/nano/CodedOutputByteBufferNano.java
+10
-12
No files found.
javanano/src/main/java/com/google/protobuf/nano/CodedOutputByteBufferNano.java
View file @
695715ad
...
...
@@ -33,6 +33,7 @@ package com.google.protobuf.nano;
import
java.io.IOException
;
import
java.nio.BufferOverflowException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.nio.ReadOnlyBufferException
;
/**
...
...
@@ -61,6 +62,7 @@ public final class CodedOutputByteBufferNano {
private
CodedOutputByteBufferNano
(
final
ByteBuffer
buffer
)
{
this
.
buffer
=
buffer
;
this
.
buffer
.
order
(
ByteOrder
.
LITTLE_ENDIAN
);
}
/**
...
...
@@ -1038,24 +1040,20 @@ public final class CodedOutputByteBufferNano {
/** Write a little-endian 32-bit integer. */
public
void
writeRawLittleEndian32
(
final
int
value
)
throws
IOException
{
writeRawByte
((
value
)
&
0xFF
);
writeRawByte
((
value
>>
8
)
&
0xFF
);
writeRawByte
((
value
>>
16
)
&
0xFF
);
writeRawByte
((
value
>>
24
)
&
0xFF
);
if
(
buffer
.
remaining
()
<
4
)
{
throw
new
OutOfSpaceException
(
buffer
.
position
(),
buffer
.
limit
()
);
}
buffer
.
putInt
(
value
);
}
public
static
final
int
LITTLE_ENDIAN_32_SIZE
=
4
;
/** Write a little-endian 64-bit integer. */
public
void
writeRawLittleEndian64
(
final
long
value
)
throws
IOException
{
writeRawByte
((
int
)(
value
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
8
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
16
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
24
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
32
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
40
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
48
)
&
0xFF
);
writeRawByte
((
int
)(
value
>>
56
)
&
0xFF
);
if
(
buffer
.
remaining
()
<
8
)
{
throw
new
OutOfSpaceException
(
buffer
.
position
(),
buffer
.
limit
());
}
buffer
.
putLong
(
value
);
}
public
static
final
int
LITTLE_ENDIAN_64_SIZE
=
8
;
...
...
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