--- a/Stream.st Sat Feb 13 21:05:21 2016 +0100
+++ b/Stream.st Sat Feb 13 23:44:19 2016 +0100
@@ -1534,6 +1534,14 @@
"Modified: / 14.1.1998 / 15:40:41 / cg"
!
+nextLong
+ "Read four bytes (msb-first) and return the value as a 32-bit signed Integer.
+ The returned value may be a LargeInteger.
+ (msb-first for compatibility with other smalltalks)"
+
+ ^ self nextInt32MSB:true
+!
+
nextLongMSB:msbFlag
"return a signed long (4 bytes) from the stream.
The receiver must support reading of binary bytes.
@@ -1621,25 +1629,7 @@
order, please use the corresponding xxxNet methods, which use a standard
network byte order."
- |b1 b2 b3 b4 val|
-
- b1 := self nextByte.
- b2 := self nextByte.
- b3 := self nextByte.
- b4 := self nextByte.
-
- msbFlag ifTrue:[
- val := b1.
- val := (val bitShift:8) bitOr:b2.
- val := (val bitShift:8) bitOr:b3.
- val := (val * 256) + b4.
- ^ val
- ].
- val := b4.
- val := (val bitShift:8) bitOr:b3.
- val := (val bitShift:8) bitOr:b2.
- val := (val * 256) + b1.
- ^ val
+ ^ self nextUnsignedInt32MSB:msbFlag
"Modified: 11.7.1996 / 10:07:13 / cg"
!
@@ -1648,7 +1638,7 @@
"return an unsigned long (4 bytes) in network byte order from the stream.
The receiver must support reading of binary bytes."
- ^ self nextUnsignedLongMSB:true
+ ^ self nextUnsignedInt32MSB:true
"Created: 10.1.1996 / 19:49:02 / cg"
"Modified: 10.1.1996 / 19:49:50 / cg"
@@ -1666,15 +1656,7 @@
order, please use the corresponding xxxNet methods, which use a standard
network byte order."
- |b1 b2|
-
- b1 := self nextByte.
- b2 := self nextByte.
-
- msbFlag ifTrue:[
- ^ (b1 bitShift:8) bitOr:b2
- ].
- ^ (b2 bitShift:8) bitOr:b1
+ ^ self nextUnsignedInt16MSB:msbFlag
"Modified: 11.7.1996 / 10:07:20 / cg"
!
@@ -1684,7 +1666,7 @@
The receiver must support reading of binary bytes.
Network byte order is MSB per definition"
- ^ self nextUnsignedShortMSB:true
+ ^ self nextUnsignedInt16MSB:true
"Created: 10.1.1996 / 19:50:02 / cg"
! !