#REFACTORING
class: ExternalLong
comment/format in: #documentation
changed:
#asInteger (send #signedInt32At:MSB: instead of #signedDoubleWordAt:MSB:, send #signedInt64At:MSB: instead of #longLongAt:bigEndian:)
#asUnsignedInteger (send #unsignedInt64At:MSB: instead of #unsignedLongLongAt:bigEndian:, send #unsignedInt32At:MSB: instead of #doubleWordAt:MSB:)
--- a/ExternalLong.st Wed Mar 23 14:33:58 2016 +0100
+++ b/ExternalLong.st Wed Mar 23 14:35:45 2016 +0100
@@ -41,9 +41,11 @@
documentation
"
mostly added for odbc, which uses instances of me as container in which values
- (pointers) are returned. The name is misleading: it should be ExternalPointer,
+ (pointers) are returned.
+ The name is very misleading: it should be ExternalPointer,
because on machines where sizeof(long) !!= sizeof(void *), that makes a difference.
- However, over time, others started to use this class, and renaming it would break some code.
+ However, over time, others started to use this class,
+ and renaming it would break some code.
"
! !
@@ -116,13 +118,13 @@
!
asInteger
- "warning: retrieves an integer with the size of the native machine's
+ "warning: retrieves a signed integer with the size of the native machine's
pointer (i.e. either 32 or 64bit)"
ExternalAddress pointerSize == 8 ifTrue:[
- ^ self longLongAt:1 bigEndian:IsBigEndian
+ ^ self signedInt64At:1 MSB:IsBigEndian
] ifFalse:[
- ^ self signedDoubleWordAt:1 MSB:IsBigEndian
+ ^ self signedInt32At:1 MSB:IsBigEndian
]
"
@@ -157,15 +159,13 @@
!
asUnsignedInteger
- "warning: only returns a 32bit integer"
-
"warning: retrieves an integer with the size of the native machine's
pointer (i.e. either 32 or 64bit)"
ExternalAddress pointerSize == 8 ifTrue:[
- ^ self unsignedLongLongAt:1 bigEndian:IsBigEndian
+ ^ self unsignedInt64At:1 MSB:IsBigEndian
] ifFalse:[
- ^ self doubleWordAt:1 MSB:IsBigEndian
+ ^ self unsignedInt32At:1 MSB:IsBigEndian
]
"