Are PureBasic's integer types little or big endian?
Posted: Thu Apr 27, 2023 1:26 pm
Hi all.
I'm currently writing a tool to read binary data from a file, and perform some actions on it. From some hex editing, I've determined that the integers are uint32_ts, and byteorder is little-endian. I don't want to lock this program to 32-bit, and because ReadInteger() reads a different number of bytes based on your compiler, I figured I'd use ReadLong(), because it claims to read 4 bytes. However, is the return of this procedure little or big endian? I (surprisingly) can't find any mentions of endianness mentioned in the PB docs (not even in the variables and datatypes section). I can write a converter if they're big endian, but I was curious if anyone knows?
Thanks in advance!
Edit to clarify that I'm talking about Windows, running on an AMD Ryzen. I assume it's little-endian, but I know some languages are weird about this, and I was also hitting a weird problem with reading longs, but I'm not sure if it's an issue of endianness, that's just my first suspect.
I'm currently writing a tool to read binary data from a file, and perform some actions on it. From some hex editing, I've determined that the integers are uint32_ts, and byteorder is little-endian. I don't want to lock this program to 32-bit, and because ReadInteger() reads a different number of bytes based on your compiler, I figured I'd use ReadLong(), because it claims to read 4 bytes. However, is the return of this procedure little or big endian? I (surprisingly) can't find any mentions of endianness mentioned in the PB docs (not even in the variables and datatypes section). I can write a converter if they're big endian, but I was curious if anyone knows?
Thanks in advance!
Edit to clarify that I'm talking about Windows, running on an AMD Ryzen. I assume it's little-endian, but I know some languages are weird about this, and I was also hitting a weird problem with reading longs, but I'm not sure if it's an issue of endianness, that's just my first suspect.