Rerubi icon indicating copy to clipboard operation
Rerubi copied to clipboard

Support different endianness

Open ghost opened this issue 7 years ago • 7 comments

Tried running a script compiled from Linux and it doesn't work, most likely due to the endianness of bytes being swapped.

ghost avatar Sep 19 '18 22:09 ghost

Will look into it

Rerumu avatar Oct 17 '18 11:10 Rerumu

On Linux, the vast majority of software is compiled for a 64-bit operating system (read: a size_t is 8 bytes instead of 4.) Linux doesn't inherently imply a different endianness, so the issue is probably not that.

gonzalezjo avatar Feb 17 '19 00:02 gonzalezjo

I forgot to eventually look into this; with that said it's probably better if I was provided with an error message from OP. The code is a bit dusty and a rewrite of something so it might be iffy to mess with.

Rerumu avatar Feb 17 '19 00:02 Rerumu

Linux is big endian by default, while Windows is little endian by default. Rerubi assumes little endian for float and integer reading. 64 bit code works; big endian code does not.

ghost avatar Feb 17 '19 01:02 ghost

Lua's compiler uses the default endianness of the platform, which is why the endianness bit is important, and why luac files on Linux platforms will not run on Windows platforms.

ghost avatar Feb 17 '19 01:02 ghost

Okay, I'll take that back. Completely wrong there (thanks google). However I don't think that should be the issue.

ghost avatar Feb 17 '19 01:02 ghost

Linux is big endian by default, while Windows is little endian by default.

This is false, as you seem to have realized. Endianness is a characteristic of the processor.

The issue is almost definitely related to the size of a size_t.

gonzalezjo avatar Feb 18 '19 23:02 gonzalezjo