On Fri, Feb 9, 2024 at 11:27 AM <christoph.thiede@student.hpi.uni-potsdam.de> wrote:
Hi Nicolas, Tim, Jakob,

> Note that LargePositive/NegativeInteger convert the magnitude as ByteArray.
> I presume we should do the same for negative SmallInteger...
> But the fact that two different (Small)Integer convert to the same
> ByteArray is a smell, isn't it?

Could you give me an example?

1 and -1

Arguably negative numbers should throw an error.
 
> The VM won't do any flip of bytes (except at image startup if we restore on a platform with different endianness - untested, because we currently have no such platform).

Sorry, I should have expressed my question more clearly: will ByteArray adoptInstance: #(1 2 3 100 255 256) asWordArray perform any malloc/memcpy of all the data or will the VM just change the class membership of the existing object? Asking as a VM noob. :-)

It will only rewrite the object header, no reallocation. That's what makes it much more efficient than using #become:, but it only works if the format is compatible and the storage size identical.

Vanessa