lib/DeflateDistanceModel.js
function(size, extraStates,
                                        lgDistanceModelFactory,
                                        lengthBitsModelFactory) {
        var i;
        var bits = Util.fls(size-1);
        this.extraStates = +extraStates || 0;
        this.lgDistanceModel = lgDistanceModelFactory(2*bits + extraStates);
        // this.distanceModel[n] used for distances which are n-bits long,
        // but only n-2 bits are encoded: the top bit is known to be one,
        // and the next bit is encoded by the lgDistanceModel.
        this.distanceModel = [];
        for (i=3 ; i <= bits; i++) {
            var numBits = i - 2;
            this.distanceModel[i] = lengthBitsModelFactory(1<<numBits);
        }
    }
function(size, extraStates,
                                        lgDistanceModelFactory,
                                        lengthBitsModelFactory) {
        var i;
        var bits = Util.fls(size-1);
        this.extraStates = +extraStates || 0;
        this.lgDistanceModel = lgDistanceModelFactory(2*bits + extraStates);
        // this.distanceModel[n] used for distances which are n-bits long,
        // but only n-2 bits are encoded: the top bit is known to be one,
        // and the next bit is encoded by the lgDistanceModel.
        this.distanceModel = [];
        for (i=3 ; i <= bits; i++) {
            var numBits = i - 2;
            this.distanceModel[i] = lengthBitsModelFactory(1<<numBits);
        }
    }
function ( size , extraStates , lgDistanceModelFactory , lengthBitsModelFactory ) { var i ; var bits = Util . fls ( size - 1 ) ; this . extraStates = + extraStates || 0 ; this . lgDistanceModel = lgDistanceModelFactory ( 2 * bits + extraStates ) ; // this.distanceModel[n] used for distances which are n-bits long, // but only n-2 bits are encoded: the top bit is known to be one, // and the next bit is encoded by the lgDistanceModel. this . distanceModel = [ ] ; for ( i = 3 ; i <= bits ; i ++ ) { var numBits = i - 2 ; this . distanceModel [ i ] = lengthBitsModelFactory ( 1 << numBits ) ; } }
lengthBitsModelFactory will be called with arguments 2, 4, 8, 16, etc and must return an appropriate model or coder.
lengthBitsModelFactory will be called with arguments 2 4 8 16 etc and must return an appropriate model or coder .