Skip to content

Commit 1e9a2f1

Browse files
committed
Fixing issue 4
1 parent 56ef0f0 commit 1e9a2f1

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

FastIntegerCompression.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ FastIntegerCompression.uncompress = function(input) {
149149
}
150150
c = inbyte[pos++];
151151
v |= c << 28;
152+
v >>>= 0; // make positive
152153
array.push(v)
153154
}
154155
return array;

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ From the compressed data, you can later recover the original array quickly
1212

1313
```javascript
1414
// var FastIntegerCompression = require("fastintcompression");// if you use node
15-
var array = [10,100000,65999,10,10,0,1,1,2000];
15+
var array = [10,100000,65999,10,10,0,1,1,2000,0xFFFFFFFF];
1616
var buf = FastIntegerCompression.compress(array);
1717
var back = FastIntegerCompression.uncompress(buf); // gets back [10,100000,65999,10,10,0,1,1,2000]
1818
```
1919

20-
By default, non-negative integers are expected. If you have signed (negative and positive) integers, then you must use distinct functions since we need to code the sign bit:
20+
By default, non-negative 32-bit integers are expected. If you have signed (negative and positive) 32-bit integers, then you must use distinct functions since we need to code the sign bit:
2121

2222

2323
```javascript

unit/basictests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('FastIntegerCompression', function() {
1515
};
1616

1717
it('Testing simple compression', function() {
18-
var array = [10,100000,65999,10,10,0,1,1,2000];
18+
var array = [10,100000,65999,10,10,0,1,1,2000,0xFFFFFFFF];
1919
var buf = FastIntegerCompression.compress(array);
2020
if(! FastIntegerCompression.computeHowManyIntegers(buf) == array.length) throw "bad count";
2121
var back = FastIntegerCompression.uncompress(buf);

0 commit comments

Comments
 (0)