@@ -1120,20 +1120,17 @@ function createMemberStreamer(element, file, no_string) {
11201120 member . factor = 1 / element . fFactor ;
11211121 member . min = element . fXmin ;
11221122 member . read = function ( buf ) { return buf . ntou4 ( ) * this . factor + this . min ; } ;
1123- } else
1124- if ( ( element . fXmin === 0 ) && member . double32 )
1125- member . read = function ( buf ) { return buf . ntof ( ) ; } ;
1126- else {
1127- member . nbits = Math . round ( element . fXmin ) ;
1128- if ( member . nbits === 0 )
1129- member . nbits = 12 ;
1130- member . dv = new DataView ( new ArrayBuffer ( 8 ) , 0 ) ; // used to cast from uint32 to float32
1131- member . read = function ( buf ) {
1132- const theExp = buf . ntou1 ( ) , theMan = buf . ntou2 ( ) ;
1133- this . dv . setUint32 ( 0 , ( theExp << 23 ) | ( ( theMan & ( ( 1 << ( this . nbits + 1 ) ) - 1 ) ) << ( 23 - this . nbits ) ) ) ;
1134- return ( ( 1 << ( this . nbits + 1 ) & theMan ) ? - 1 : 1 ) * this . dv . getFloat32 ( 0 ) ;
1135- } ;
1136- }
1123+ } else if ( ( element . fXmin === 0 ) && member . double32 )
1124+ member . read = function ( buf ) { return buf . ntof ( ) ; } ;
1125+ else {
1126+ member . nbits = Math . round ( element . fXmin ) || 12 ;
1127+ member . dv = new DataView ( new ArrayBuffer ( 8 ) , 0 ) ; // used to cast from uint32 to float32
1128+ member . read = function ( buf ) {
1129+ const theExp = buf . ntou1 ( ) , theMan = buf . ntou2 ( ) ;
1130+ this . dv . setUint32 ( 0 , ( theExp << 23 ) | ( ( theMan & ( ( 1 << ( this . nbits + 1 ) ) - 1 ) ) << ( 23 - this . nbits ) ) ) ;
1131+ return ( ( 1 << ( this . nbits + 1 ) & theMan ) ? - 1 : 1 ) * this . dv . getFloat32 ( 0 ) ;
1132+ } ;
1133+ }
11371134
11381135 member . readarr = function ( buf , len ) {
11391136 const arr = this . double32 ? new Float64Array ( len ) : new Float32Array ( len ) ;
@@ -1144,23 +1141,21 @@ function createMemberStreamer(element, file, no_string) {
11441141
11451142 if ( member . type < kOffsetL )
11461143 member . func = function ( buf , obj ) { obj [ this . name ] = this . read ( buf ) ; } ;
1147- else
1148- if ( member . type > kOffsetP ) {
1149- member . cntname = element . fCountName ;
1150- member . func = function ( buf , obj ) {
1151- obj [ this . name ] = ( buf . ntou1 ( ) === 1 ) ? this . readarr ( buf , obj [ this . cntname ] ) : null ;
1152- } ;
1153- } else
1154- if ( element . fArrayDim < 2 ) {
1155- member . arrlength = element . fArrayLength ;
1156- member . func = function ( buf , obj ) { obj [ this . name ] = this . readarr ( buf , this . arrlength ) ; } ;
1157- } else {
1158- member . arrlength = element . fMaxIndex [ element . fArrayDim - 1 ] ;
1159- member . minus1 = true ;
1160- member . func = function ( buf , obj ) {
1161- obj [ this . name ] = buf . readNdimArray ( this , ( buf2 , handle ) => handle . readarr ( buf2 , handle . arrlength ) ) ;
1162- } ;
1163- }
1144+ else if ( member . type > kOffsetP ) {
1145+ member . cntname = element . fCountName ;
1146+ member . func = function ( buf , obj ) {
1147+ obj [ this . name ] = ( buf . ntou1 ( ) === 1 ) ? this . readarr ( buf , obj [ this . cntname ] ) : null ;
1148+ } ;
1149+ } else if ( element . fArrayDim < 2 ) {
1150+ member . arrlength = element . fArrayLength ;
1151+ member . func = function ( buf , obj ) { obj [ this . name ] = this . readarr ( buf , this . arrlength ) ; } ;
1152+ } else {
1153+ member . arrlength = element . fMaxIndex [ element . fArrayDim - 1 ] ;
1154+ member . minus1 = true ;
1155+ member . func = function ( buf , obj ) {
1156+ obj [ this . name ] = buf . readNdimArray ( this , ( buf2 , handle ) => handle . readarr ( buf2 , handle . arrlength ) ) ;
1157+ } ;
1158+ }
11641159 break ;
11651160
11661161 case kAnyP :
0 commit comments