more performance tuning
This commit is contained in:
parent
acb7c6b16f
commit
ea572ad47f
10 changed files with 357 additions and 165 deletions
|
|
@ -107,23 +107,6 @@ public class ByteDataReader
|
|||
return ( v & 1 ) == 0 ? v >> 1 : -(v >> 1 );
|
||||
}
|
||||
|
||||
public final int readVarLengthUnsigned_old()
|
||||
{
|
||||
int v = 0;
|
||||
int shift = 0;
|
||||
for ( ;; )
|
||||
{
|
||||
byte b = ab[aboffset++];
|
||||
v |= ( ( b & 0x7f ) << shift );
|
||||
if ( ( b & 0x80 ) == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
shift += 7;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public final int readVarLengthUnsigned()
|
||||
{
|
||||
byte b;
|
||||
|
|
@ -135,15 +118,7 @@ public class ByteDataReader
|
|||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 21;
|
||||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 28;
|
||||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 35;
|
||||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 42;
|
||||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 49;
|
||||
if ( b >= 0 ) return v;
|
||||
v |= ( (b=ab[aboffset++]) & 0x7f ) << 56;
|
||||
v |= ( (b=ab[aboffset++]) & 0xf ) << 28;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue