Few refactorings & formatting

This commit is contained in:
Jindra Petk
2013-08-03 16:33:48 +02:00
parent d5c1d81cd8
commit b01ede8cca
15 changed files with 65 additions and 54 deletions

View File

@@ -456,6 +456,15 @@ public class SWFOutputStream extends OutputStream {
}
return nBits;
}
public static int getNeededBitsU(int first, int... params) {
int nBits = 0;
nBits = enlargeBitCountU(nBits, first);
for (int i = 0; i < params.length; i++) {
nBits = enlargeBitCountU(nBits, params[i]);
}
return nBits;
}
private static long getIntPart(double value) {
if (value < 0) {
@@ -491,13 +500,21 @@ public class SWFOutputStream extends OutputStream {
return getNeededBitsS(k) + 16;
}
private static int enlargeBitCountS(int currentBitCount, int value) {
public static int enlargeBitCountS(int currentBitCount, int value) {
int neededNew = getNeededBitsS(value);
if (neededNew > currentBitCount) {
return neededNew;
}
return currentBitCount;
}
public static int enlargeBitCountU(int currentBitCount, int value) {
int neededNew = getNeededBitsU(value);
if (neededNew > currentBitCount) {
return neededNew;
}
return currentBitCount;
}
/**
* Writes MATRIX value to the stream