Skip to content

Commit

Permalink
fixed size calculation in encodePacking
Browse files Browse the repository at this point in the history
  • Loading branch information
arose committed Jun 26, 2017
1 parent da85eed commit 02c3d13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mmtf-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ function encodePacking( intArray, useInt8 ){
var value = intArray[ i ];
if( value === 0 ){
++size;
}else if( value === upperLimit || value === lowerLimit ){
size += 2;
}else if( value > 0) {
size += Math.ceil( value / upperLimit );
if (value % upperLimit === 0) size += 1;
}else {
size += Math.ceil( value / lowerLimit );
if (value % lowerLimit === 0) size += 1;
}
}
var output = useInt8 ? new Int8Array( size ) : new Int16Array( size );
Expand Down

0 comments on commit 02c3d13

Please sign in to comment.