Quantcast

changes in FFI-Kernel-eem.43 break 32bits version (at least for me)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

changes in FFI-Kernel-eem.43 break 32bits version (at least for me)

EstebanLM
 
Hi,

I found that this change:

unsignedLongLongAt: byteOffset
        "Answer a 64-bit integer in Smalltalk order (little-endian)."
        ^self integerAt: byteOffset size: 8 signed: false

unsignedLongLongAt: byteOffset put: value
        "I store 64-bit integers in Smalltalk (little-endian) order."
        ^self integerAt: byteOffset put: value size: 8 signed: false

… which makes sense at fist sight does not work at least for me. In 32bits scenario, this test will fail:

 { -9223372036854775808. -9223372036854775807. -2147483649. -2147483648. -2147483647. -32769. -32768. -32767. -129. -128. -127. 0. 126. 127. 128. 254. 255. 256. 32766. 32767. 32768. 65534. 65535. 65536. 2147483646. 2147483647. 2147483648. 9223372036854775806. 9223372036854775807 } do: [ :int |
                |ref|
                ref := ByteArray new: 8.
                ref signedLongLongAt: 1 put: int.
                self assert: (ref signedLongLongAt: 1) = int ]

can you confirm it?

cheers,
Esteban
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: changes in FFI-Kernel-eem.43 break 32bits version (at least for me)

Nicolas Cellier
 
Hi Esteban,
primitiveFFIIntegerAtPut can't operate on 64 int in a 32 bits vm as it is now.
I'll commit a fix.

2017-01-05 9:59 GMT+01:00 Esteban Lorenzano <[hidden email]>:

Hi,

I found that this change:

unsignedLongLongAt: byteOffset
        "Answer a 64-bit integer in Smalltalk order (little-endian)."
        ^self integerAt: byteOffset size: 8 signed: false

unsignedLongLongAt: byteOffset put: value
        "I store 64-bit integers in Smalltalk (little-endian) order."
        ^self integerAt: byteOffset put: value size: 8 signed: false

… which makes sense at fist sight does not work at least for me. In 32bits scenario, this test will fail:

 { -9223372036854775808. -9223372036854775807. <a href="tel:-2147483649" value="+12147483649">-2147483649. -<a href="tel:2147483648" value="+12147483648">2147483648. -<a href="tel:2147483647" value="+12147483647">2147483647. -32769. -32768. -32767. -129. -128. -127. 0. 126. 127. 128. 254. 255. 256. 32766. 32767. 32768. 65534. 65535. 65536. 2147483646. 2147483647. 2147483648. 9223372036854775806. 9223372036854775807 } do: [ :int |
                |ref|
                ref := ByteArray new: 8.
                ref signedLongLongAt: 1 put: int.
                self assert: (ref signedLongLongAt: 1) = int ]

can you confirm it?

cheers,
Esteban

Loading...