17
17
'use strict' ;
18
18
19
19
20
- // you can provide an iterable
20
+ // You can provide an iterable.
21
21
function FastIntegerCompression ( ) {
22
22
}
23
23
@@ -46,8 +46,8 @@ function zigzag_decode(val) {
46
46
}
47
47
48
48
49
- // compute how many bytes an array of integers would use once compressed
50
- // input is expected to be an array of non-negative integers
49
+ // Compute how many bytes an array of integers would use once compressed.
50
+ // The input is expected to be an array of non-negative integers.
51
51
FastIntegerCompression . computeCompressedSizeInBytes = function ( input ) {
52
52
var c = input . length ;
53
53
var answer = 0 ;
@@ -58,8 +58,8 @@ FastIntegerCompression.computeCompressedSizeInBytes = function(input) {
58
58
} ;
59
59
60
60
61
- // compute how many bytes an array of integers would use once compressed
62
- // input is expected to be an array of integers, some of them can be negative
61
+ // Compute how many bytes an array of integers would use once compressed.
62
+ // The input is expected to be an array of integers, some of them can be negative.
63
63
FastIntegerCompression . computeCompressedSizeInBytesSigned = function ( input ) {
64
64
var c = input . length ;
65
65
var answer = 0 ;
@@ -104,7 +104,8 @@ FastIntegerCompression.compress = function(input) {
104
104
return buf ;
105
105
} ;
106
106
107
- // from a compressed array of integers stored ArrayBuffer, compute the number of compressed integers by scanning the input
107
+ // From a compressed array of integers stored ArrayBuffer,
108
+ // compute the number of compressed integers by scanning the input.
108
109
FastIntegerCompression . computeHowManyIntegers = function ( input ) {
109
110
var view = new Int8Array ( input ) ;
110
111
var c = view . length ;
@@ -114,11 +115,11 @@ FastIntegerCompression.computeHowManyIntegers = function(input) {
114
115
}
115
116
return c - count ;
116
117
}
117
- // uncompress an array of integer from an ArrayBuffer, return the array
118
- // it is assumed that they were compressed using the compress function, the caller
118
+ // Uncompress an array of integer from an ArrayBuffer, return the array.
119
+ // It is assumed that they were compressed using the compress function, the caller
119
120
// is responsible for ensuring that it is the case.
120
121
FastIntegerCompression . uncompress = function ( input ) {
121
- var array = [ ]
122
+ var array = [ ] // The size of the output is not yet known.
122
123
var inbyte = new Int8Array ( input ) ;
123
124
var end = inbyte . length ;
124
125
var pos = 0 ;
@@ -190,11 +191,11 @@ FastIntegerCompression.compressSigned = function(input) {
190
191
return buf ;
191
192
} ;
192
193
193
- // uncompress an array of integer from an ArrayBuffer, return the array
194
- // it is assumed that they were compressed using the compressSigned function, the caller
194
+ // Uncompress an array of integer from an ArrayBuffer, return the array.
195
+ // It is assumed that they were compressed using the compressSigned function, the caller
195
196
// is responsible for ensuring that it is the case.
196
197
FastIntegerCompression . uncompressSigned = function ( input ) {
197
- var array = [ ]
198
+ var array = [ ] // The size of the output is not yet known.
198
199
var inbyte = new Int8Array ( input ) ;
199
200
var end = inbyte . length ;
200
201
var pos = 0 ;
0 commit comments