Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c960636d
authored
Sep 18, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Stylistic cleanup.
parent
cf27b83e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
library/src/main/java/com/google/android/exoplayer/util/ParsableBitArray.java
library/src/main/java/com/google/android/exoplayer/util/ParsableBitArray.java
View file @
c960636d
...
...
@@ -127,19 +127,19 @@ public final class ParsableBitArray {
/**
* Reads up to 32 bits.
*
* @param n The number of bits to read.
* @param n
umBits
The number of bits to read.
* @return An integer whose bottom n bits hold the read data.
*/
public
int
readBits
(
int
n
)
{
if
(
n
==
0
)
{
public
int
readBits
(
int
n
umBits
)
{
if
(
n
umBits
==
0
)
{
return
0
;
}
int
returnValue
=
0
;
//
While n >= 8, read whole bytes
.
int
numBytes
=
(
n
/
8
);
for
(
int
i
=
0
;
i
<
numBytes
;
i
++)
{
//
Read as many whole bytes as we can
.
int
wholeBytes
=
(
numBits
/
8
);
for
(
int
i
=
0
;
i
<
wholeBytes
;
i
++)
{
int
byteValue
;
if
(
bitOffset
!=
0
)
{
byteValue
=
((
data
[
byteOffset
]
&
0xFF
)
<<
bitOffset
)
...
...
@@ -147,14 +147,15 @@ public final class ParsableBitArray {
}
else
{
byteValue
=
data
[
byteOffset
];
}
n
-=
8
;
returnValue
|=
(
byteValue
&
0xFF
)
<<
n
;
n
umBits
-=
8
;
returnValue
|=
(
byteValue
&
0xFF
)
<<
n
umBits
;
byteOffset
++;
}
if
(
n
>
0
)
{
int
nextBit
=
bitOffset
+
n
;
byte
writeMask
=
(
byte
)
(
0xFF
>>
(
8
-
n
));
// Read any remaining bits.
if
(
numBits
>
0
)
{
int
nextBit
=
bitOffset
+
numBits
;
byte
writeMask
=
(
byte
)
(
0xFF
>>
(
8
-
numBits
));
if
(
nextBit
>
8
)
{
// Combine bits from current byte and next byte.
...
...
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