but in C (32bits) floats are 4 bytes, so when you do: ByteArray new floatAt: 1 put: somePharoFloat; it will cast it to 4 bytes (if it fits which is most of the cases). but as I said⦠it is an error I need to fix :) Esteban
On 12 Feb 2016, at 20:50, Clément Bera <bera.clement@gmail.com> wrote:
I don't understand. All BoxedFloat have 8 bytes, that's why they are called BoxedFloat64. There are no 4-bytes floats in Pharo. Even in 32 bits.
2016-02-12 18:06 GMT+01:00 Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>>:
On 12 Feb 2016, at 17:50, Aliaksei Syrel <alex.syrel@gmail.com <mailto:alex.syrel@gmail.com>> wrote:
On Fri, Feb 12, 2016 at 5:45 PM, Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>> wrote: Float>>#pointer ^ (ByteArray new: FFIExternalType pointerSize) floatAt: 1 put: self; yourself
Yes it does the trick :) Thanks!
yes and no (I made a mistake): that works because incidentally pointers and floats have same size (4 bytes)⦠but can happen that it is not (doubles have 8 bytes)⦠but is ok for now :) I will fix it correctly next week.
Esteban