Skip to content

Commit

Permalink
Use 1 for true and 0 for false.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmrugg committed Jun 6, 2015
1 parent 6e072ec commit 843d9f6
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions src/lzma_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ var LZMA = (function () {
this$static.length_0 = length_0;
encoder = $Encoder(new Encoder());
$configure(mode, encoder);
encoder._writeEndMark = true;
encoder._writeEndMark = 1;
$WriteCoderProperties(encoder, output);
for (i = 0; i < 64; i += 8)
$write(output, lowBits_0(shr(length_0, i)) & 255);
this$static.chunker = (encoder._needReleaseMFStream = false , (encoder._inStream = input , encoder._finished = false , $Create_2(encoder) , encoder._rangeEncoder.Stream = output , $Init_4(encoder) , $FillDistancesPrices(encoder) , $FillAlignPrices(encoder) , encoder._lenEncoder._tableSize = encoder._numFastBytes + 1 - 2 , $UpdateTables(encoder._lenEncoder, 1 << encoder._posStateBits) , encoder._repMatchLenEncoder._tableSize = encoder._numFastBytes + 1 - 2 , $UpdateTables(encoder._repMatchLenEncoder, 1 << encoder._posStateBits) , encoder.nowPos64 = P0_longLit , undefined) , $Chunker_0(new Chunker(), encoder));
this$static.chunker = (encoder._needReleaseMFStream = 0 , (encoder._inStream = input , encoder._finished = 0 , $Create_2(encoder) , encoder._rangeEncoder.Stream = output , $Init_4(encoder) , $FillDistancesPrices(encoder) , $FillAlignPrices(encoder) , encoder._lenEncoder._tableSize = encoder._numFastBytes + 1 - 2 , $UpdateTables(encoder._lenEncoder, 1 << encoder._posStateBits) , encoder._repMatchLenEncoder._tableSize = encoder._numFastBytes + 1 - 2 , $UpdateTables(encoder._repMatchLenEncoder, 1 << encoder._posStateBits) , encoder.nowPos64 = P0_longLit , undefined) , $Chunker_0(new Chunker(), encoder));
}

var LZMACompressor = make_thing();
Expand Down Expand Up @@ -458,7 +458,7 @@ var LZMA = (function () {
var numReadBytes, pointerToPostion, size;
if (this$static._streamEndWasReached)
return;
while (true) {
while (1) {
size = -this$static._bufferOffset + this$static._blockSize - this$static._streamPos;
if (size == 0)
return;
Expand Down Expand Up @@ -604,7 +604,7 @@ var LZMA = (function () {
}
}
count = this$static._cutValue;
while (true) {
while (1) {
if (curMatch <= matchMinPos || count-- == 0) {
this$static._son[ptr0] = this$static._son[ptr1] = 0;
break;
Expand Down Expand Up @@ -726,7 +726,7 @@ var LZMA = (function () {
ptr1 = this$static._cyclicBufferPos << 1;
len0 = len1 = this$static.kNumHashDirectBytes;
count = this$static._cutValue;
while (true) {
while (1) {
if (curMatch <= matchMinPos || count-- == 0) {
this$static._son[ptr0] = this$static._son[ptr1] = 0;
break;
Expand Down Expand Up @@ -850,15 +850,15 @@ var LZMA = (function () {
function $Chunker_0(this$static, encoder) {
this$static.encoder = encoder;
this$static.decoder = null;
this$static.alive = true;
this$static.alive = 1;
return this$static;
}
/** ce */
/** ds */
function $Chunker(this$static, decoder) {
this$static.decoder = decoder;
this$static.encoder = null;
this$static.alive = true;
this$static.alive = 1;
return this$static;
}
/** de */
Expand Down Expand Up @@ -894,7 +894,7 @@ var LZMA = (function () {
$Flush_0(this$static.decoder.m_OutWindow);
$ReleaseStream(this$static.decoder.m_OutWindow);
this$static.decoder.m_RangeDecoder.Stream = null;
this$static.alive = false;
this$static.alive = 0;
}
}
/** de */
Expand All @@ -904,7 +904,7 @@ var LZMA = (function () {
this$static.inBytesProcessed = this$static.encoder.processedInSize[0];
if (this$static.encoder.finished[0]) {
$ReleaseStreams(this$static.encoder);
this$static.alive = false;
this$static.alive = 0;
}
}
/** ce */
Expand Down Expand Up @@ -1048,7 +1048,7 @@ var LZMA = (function () {
function $SetDecoderProperties(this$static, properties) {
var dictionarySize, i, lc, lp, pb, remainder, val;
if (properties.length < 5)
return false;
return 0;
val = properties[0] & 255;
lc = val % 9;
remainder = ~~(val / 9);
Expand All @@ -1060,33 +1060,33 @@ var LZMA = (function () {
}
///NOTE: If the input is bad, it might call for an insanely large dictionary size, which would crash the script.
if (dictionarySize > 99999999 || !$SetLcLpPb(this$static, lc, lp, pb)) {
return false;
return 0;
}
return $SetDictionarySize(this$static, dictionarySize);
}

function $SetDictionarySize(this$static, dictionarySize) {
if (dictionarySize < 0) {
return false;
return 0;
}
if (this$static.m_DictionarySize != dictionarySize) {
this$static.m_DictionarySize = dictionarySize;
this$static.m_DictionarySizeCheck = Math.max(this$static.m_DictionarySize, 1);
$Create_5(this$static.m_OutWindow, Math.max(this$static.m_DictionarySizeCheck, 4096));
}
return true;
return 1;
}

function $SetLcLpPb(this$static, lc, lp, pb) {
if (lc > 8 || lp > 4 || pb > 4) {
return false;
return 0;
}
$Create_0(this$static.m_LiteralDecoder, lp, lc);
var numPosStates = 1 << pb;
$Create(this$static.m_LenDecoder, numPosStates);
$Create(this$static.m_RepLenDecoder, numPosStates);
this$static.m_PosStateMask = numPosStates - 1;
return true;
return 1;
}

var Decoder = make_thing();
Expand Down Expand Up @@ -1247,17 +1247,17 @@ var LZMA = (function () {
var baseVal, complexState, curByte, distance, footerBits, i, len, lenToPosState, matchByte, pos, posReduced, posSlot, posState, progressPosValuePrev, subCoder;
inSize[0] = P0_longLit;
outSize[0] = P0_longLit;
finished[0] = true;
finished[0] = 1;
if (this$static._inStream) {
this$static._matchFinder._stream = this$static._inStream;
$Init_5(this$static._matchFinder);
this$static._needReleaseMFStream = true;
this$static._needReleaseMFStream = 1;
this$static._inStream = null;
}
if (this$static._finished) {
return;
}
this$static._finished = true;
this$static._finished = 1;
progressPosValuePrev = this$static.nowPos64;
if (eq(this$static.nowPos64, P0_longLit)) {
if ($GetNumAvailableBytes(this$static._matchFinder) == 0) {
Expand All @@ -1278,7 +1278,7 @@ var LZMA = (function () {
$Flush(this$static, lowBits_0(this$static.nowPos64));
return;
}
while (true) {
while (1) {
len = $GetOptimum(this$static, lowBits_0(this$static.nowPos64));
pos = this$static.backRes;
posState = lowBits_0(this$static.nowPos64) & this$static._posStateMask;
Expand Down Expand Up @@ -1373,8 +1373,8 @@ var LZMA = (function () {
return;
}
if (compare(sub(this$static.nowPos64, progressPosValuePrev), [4096, 0]) >= 0) {
this$static._finished = false;
finished[0] = false;
this$static._finished = 0;
finished[0] = 0;
return;
}
}
Expand Down Expand Up @@ -1426,7 +1426,7 @@ var LZMA = (function () {
this$static.repLens = initDim(4);
this$static.processedInSize = [P0_longLit];
this$static.processedOutSize = [P0_longLit];
this$static.finished = [false];
this$static.finished = [0];
this$static.properties = initDim(5);
this$static.tempPrices = initDim(128);
for (i = 0; i < 4096; ++i) {
Expand Down Expand Up @@ -1490,7 +1490,7 @@ var LZMA = (function () {
this$static._optimumCurrentIndex = this$static._optimumEndIndex = 0;
if (this$static._longestMatchWasFound) {
lenMain = this$static._longestMatchLength;
this$static._longestMatchWasFound = false;
this$static._longestMatchWasFound = 0;
} else {
lenMain = $ReadMatchDistances(this$static);
}
Expand Down Expand Up @@ -1598,7 +1598,7 @@ var LZMA = (function () {
}
}
cur = 0;
while (true) {
while (1) {
++cur;
if (cur == lenEnd) {
return $Backward(this$static, cur);
Expand All @@ -1607,7 +1607,7 @@ var LZMA = (function () {
numDistancePairs = this$static._numDistancePairs;
if (newLen >= this$static._numFastBytes) {
this$static._longestMatchLength = newLen;
this$static._longestMatchWasFound = true;
this$static._longestMatchWasFound = 1;
return $Backward(this$static, cur);
}
++position;
Expand Down Expand Up @@ -1688,13 +1688,13 @@ var LZMA = (function () {
posState = position & this$static._posStateMask;
curAnd1Price = curPrice + ProbPrices[this$static._isMatch[(state << 4) + posState] >>> 2] + $GetPrice_0($GetSubCoder(this$static._literalEncoder, position, $GetIndexByte(this$static._matchFinder, -2)), state >= 7, matchByte, currentByte);
nextOptimum = this$static._optimum[cur + 1];
nextIsChar = false;
nextIsChar = 0;
if (curAnd1Price < nextOptimum.Price) {
nextOptimum.Price = curAnd1Price;
nextOptimum.PosPrev = cur;
nextOptimum.BackPrev = -1;
nextOptimum.Prev1IsChar = 0;
nextIsChar = true;
nextIsChar = 1;
}
matchPrice = curPrice + ProbPrices[2048 - this$static._isMatch[(state << 4) + posState] >>> 2];
repMatchPrice = matchPrice + ProbPrices[2048 - this$static._isRep[state] >>> 2];
Expand All @@ -1705,7 +1705,7 @@ var LZMA = (function () {
nextOptimum.PosPrev = cur;
nextOptimum.BackPrev = 0;
nextOptimum.Prev1IsChar = 0;
nextIsChar = true;
nextIsChar = 1;
}
}
numAvailableBytesFull = $GetNumAvailableBytes(this$static._matchFinder) + 1;
Expand Down Expand Up @@ -1769,7 +1769,7 @@ var LZMA = (function () {
if (lenTest2 >= 2) {
state2 = state < 7?8:11;
posStateNext = position + lenTest & this$static._posStateMask;
curAndLenCharPrice = repMatchPrice + (price_1 = $GetPrice(this$static._repMatchLenEncoder, lenTest - 2, posState) , price_1 + $GetPureRepPrice(this$static, repIndex, state, posState)) + ProbPrices[this$static._isMatch[(state2 << 4) + posStateNext] >>> 2] + $GetPrice_0($GetSubCoder(this$static._literalEncoder, position + lenTest, $GetIndexByte(this$static._matchFinder, lenTest - 1 - 1)), true, $GetIndexByte(this$static._matchFinder, lenTest - 1 - (this$static.reps[repIndex] + 1)), $GetIndexByte(this$static._matchFinder, lenTest - 1));
curAndLenCharPrice = repMatchPrice + (price_1 = $GetPrice(this$static._repMatchLenEncoder, lenTest - 2, posState) , price_1 + $GetPureRepPrice(this$static, repIndex, state, posState)) + ProbPrices[this$static._isMatch[(state2 << 4) + posStateNext] >>> 2] + $GetPrice_0($GetSubCoder(this$static._literalEncoder, position + lenTest, $GetIndexByte(this$static._matchFinder, lenTest - 1 - 1)), 1, $GetIndexByte(this$static._matchFinder, lenTest - 1 - (this$static.reps[repIndex] + 1)), $GetIndexByte(this$static._matchFinder, lenTest - 1));
state2 = StateUpdateChar(state2);
posStateNext = position + lenTest + 1 & this$static._posStateMask;
nextMatchPrice = curAndLenCharPrice + ProbPrices[2048 - this$static._isMatch[(state2 << 4) + posStateNext] >>> 2];
Expand Down Expand Up @@ -1825,7 +1825,7 @@ var LZMA = (function () {
if (lenTest2 >= 2) {
state2 = state < 7?7:10;
posStateNext = position + lenTest & this$static._posStateMask;
curAndLenCharPrice = curAndLenPrice + ProbPrices[this$static._isMatch[(state2 << 4) + posStateNext] >>> 2] + $GetPrice_0($GetSubCoder(this$static._literalEncoder, position + lenTest, $GetIndexByte(this$static._matchFinder, lenTest - 1 - 1)), true, $GetIndexByte(this$static._matchFinder, lenTest - (curBack + 1) - 1), $GetIndexByte(this$static._matchFinder, lenTest - 1));
curAndLenCharPrice = curAndLenPrice + ProbPrices[this$static._isMatch[(state2 << 4) + posStateNext] >>> 2] + $GetPrice_0($GetSubCoder(this$static._literalEncoder, position + lenTest, $GetIndexByte(this$static._matchFinder, lenTest - 1 - 1)), 1, $GetIndexByte(this$static._matchFinder, lenTest - (curBack + 1) - 1), $GetIndexByte(this$static._matchFinder, lenTest - 1));
state2 = StateUpdateChar(state2);
posStateNext = position + lenTest + 1 & this$static._posStateMask;
nextMatchPrice = curAndLenCharPrice + ProbPrices[2048 - this$static._isMatch[(state2 << 4) + posStateNext] >>> 2];
Expand Down Expand Up @@ -1904,7 +1904,7 @@ var LZMA = (function () {
$Init_2(this$static._lenEncoder, 1 << this$static._posStateBits);
$Init_2(this$static._repMatchLenEncoder, 1 << this$static._posStateBits);
InitBitModels(this$static._posAlignEncoder.Models);
this$static._longestMatchWasFound = false;
this$static._longestMatchWasFound = 0;
this$static._optimumEndIndex = 0;
this$static._optimumCurrentIndex = 0;
this$static._additionalOffset = 0;
Expand Down Expand Up @@ -1932,7 +1932,7 @@ var LZMA = (function () {
function $ReleaseMFStream(this$static) {
if (!!this$static._matchFinder && this$static._needReleaseMFStream) {
this$static._matchFinder._stream = null;
this$static._needReleaseMFStream = false;
this$static._needReleaseMFStream = 0;
}
}

Expand Down Expand Up @@ -2143,7 +2143,7 @@ var LZMA = (function () {
}

function $EncodeMatched(this$static, rangeEncoder, matchByte, symbol) {
var bit, i, matchBit, state, same = true, context = 1;
var bit, i, matchBit, state, same = 1, context = 1;
for (i = 7; i >= 0; --i) {
bit = symbol >> i & 1;
state = context;
Expand Down Expand Up @@ -2571,7 +2571,7 @@ var LZMA = (function () {
update_progress(percent, cbn);
}
wait(do_action, 0);
return false;
return 0;
}
}

Expand Down Expand Up @@ -2640,7 +2640,7 @@ var LZMA = (function () {

///NOTE: This allows other code to run, like the browser to update.
wait(do_action, 0);
return false;
return 0;
}
}

Expand Down

0 comments on commit 843d9f6

Please sign in to comment.