diff -r 12f03c97d9bd -r 34208e6488b8 Stream.st --- a/Stream.st Tue Apr 19 20:02:43 2016 +0200 +++ b/Stream.st Tue Apr 19 20:15:12 2016 +0200 @@ -1339,7 +1339,7 @@ order, please use the corresponding xxxNet methods, which use a standard network byte order." - |val shift| + |val shift bytes| "claus: this method is central in binaryStorage - therefore it has been tuned a bit (and needs even more tuning)" @@ -1359,29 +1359,36 @@ numBytes == 8 ifTrue:[ ^ self nextUnsignedInt64MSB:msbFlag ]. - - val := 0. - msbFlag ifTrue:[ - numBytes timesRepeat:[ - val := (val bitShift:8) + self nextByte - ]. - ] ifFalse:[ - shift := 0. - numBytes timesRepeat:[ - val := val + (self nextByte bitShift:shift). - shift := shift + 8. - ]. - ]. - ^ val + "/ bytes + bytes := self nextBytes:numBytes. + ^ (LargeInteger digitBytes:bytes MSB:msbFlag) compressed + +"/ val := 0. +"/ msbFlag ifTrue:[ +"/ numBytes timesRepeat:[ +"/ val := (val bitShift:8) + self nextByte +"/ ]. +"/ ] ifFalse:[ +"/ shift := 0. +"/ numBytes timesRepeat:[ +"/ val := val + (self nextByte bitShift:shift). +"/ shift := shift + 8. +"/ ]. +"/ ]. +"/ ^ val " |s| s := #[ 16r01 16r02 16r03 16r04 16r05 ] readStream. (s nextUnsigned:3 MSB:true) hexPrintString. + s := #[ 16r01 16r02 16r03 16r04 16r05 16r06 16r07 16r08 16r09 ] readStream. + (s nextUnsigned:9 MSB:true) hexPrintString. s := #[ 16r01 16r02 16r03 16r04 16r05 ] readStream. (s nextUnsigned:3 MSB:false) hexPrintString. + s := #[ 16r01 16r02 16r03 16r04 16r05 16r06 16r07 16r08 16r09 ] readStream. + (s nextUnsigned:9 MSB:false) hexPrintString. " !