Skip to content

Commit

Permalink
Float numbers are only immediates if the VM has SmallFloats.
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Apr 7, 2021
1 parent 2fed4c7 commit 1297dc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Kernel-Tests/ProtoObjectTest.class.st
Expand Up @@ -200,9 +200,12 @@ ProtoObjectTest >> testNextObject [
self assert: (nil nextObject notNil).
self assert: ('test' nextObject notNil).

self should: [42 nextObject notNil] raise: ShouldNotImplement .
self should: [$x nextObject notNil] raise: ShouldNotImplement .
self should: [3.14 nextObject notNil] raise: ShouldNotImplement .
self should: [42 nextObject notNil] raise: ShouldNotImplement.
self should: [$x nextObject notNil] raise: ShouldNotImplement.

"Boxed Floats are only available in 64 bits VMs"
Smalltalk vm hasSmallFloats
ifTrue: [self should: [3.14 nextObject notNil] raise: ShouldNotImplement].

]

Expand Down
6 changes: 6 additions & 0 deletions src/System-Support/VirtualMachine.class.st
Expand Up @@ -250,6 +250,12 @@ VirtualMachine >> getSystemAttribute: attributeID [
^ nil
]

{ #category : #testing }
VirtualMachine >> hasSmallFloats [
"SmallFloats are available in 64 bits machines"
^ self wordSize = 8
]

{ #category : #accessing }
VirtualMachine >> headlessOption [
"Return the default name for the headless option for this VM"
Expand Down

0 comments on commit 1297dc1

Please sign in to comment.