--- a/Stream.st Sat Feb 05 13:23:03 1994 +0100
+++ b/Stream.st Sat Feb 05 13:24:58 1994 +0100
@@ -22,7 +22,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.4 1993-10-13 02:14:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.5 1994-02-05 12:24:58 claus Exp $
'!
!Stream class methodsFor:'instance creation'!
@@ -204,32 +204,33 @@
!Stream methodsFor: 'nonhomogeneous accessing'!
nextNumber: n
- "Answer the next n bytes as a positive Integer or LargePositiveInteger."
+ "Answer the next n bytes as a positive Integer."
| s i |
+
n <= 4 ifTrue:[
- s _ 0.
- i _ 0.
- [(i _ i + 1) <= n] whileTrue: [s _ ((s bitShift: 8) bitOr: self next)].
- ^s
+ s := 0.
+ i := 0.
+ [(i := i + 1) <= n] whileTrue: [s := ((s bitShift: 8) bitOr: self next)].
+ ^ s
].
- s _ 0.
+ s := 0.
1 to: n do: [:j | s := s * 256 + self next].
"reverse order of significance"
^s truncated
!
nextNumber: n put: v
- "Append to the receiver the argument, v, which is a positive SmallInteger or
- a LargePositiveInteger, as the next n bytes. Possibly pad with leading zeros."
-
+ "Append to the receiver the argument, v, which is a positive Integer,
+ as the next n bytes. Possibly pad with leading zeros."
| vlen i |
- n < (vlen _ v digitLength) ifTrue: [self error: 'number too big'].
+
+ n < (vlen := v digitLength) ifTrue: [self error: 'number too big'].
"pad with leading zeros"
- i _ n.
- [i > vlen] whileTrue: [self nextPut: 0. i _ i - 1].
+ i := n.
+ [i > vlen] whileTrue: [self nextPut: 0. i := i - 1].
i = 1 ifTrue: [^self nextPut: v].
- [i > 0] whileTrue: [self nextPut: (v digitAt: i). i _ i - 1]
+ [i > 0] whileTrue: [self nextPut: (v digitAt: i). i := i - 1]
! !