Register
BEdit»Forums»Big endian support
Benjamin Pedersen
29 posts

Mathematician

Big endian support
2 weeks, 3 days ago Edited by Benjamin Pedersen on Oct. 14, 2020, 12:21 p.m. Reason: Initial post
I want to use BEdit on a format that uses big endian numbers, also with enum tags.

How about simply being able to specify endianness as a type parameter (u(4, big) and TagEnum(4, big))?
Jens
23 posts / 1 project
Big endian support
2 weeks, 3 days ago
Hello Benjipede,

Byte order / endianess is something I've had on my todo-list for some time now and I was thinking of a similar approach to the one you suggest.

As files usually have the same byte order across the entire data I was thinking of also adding something like a global directive telling the interpreter to treat all data (unless specified otherwise) as big or little endian. It would be rather annoying to have to write big all over the place when you could just specify it once. However that would of course make it more complicated if some data uses big endian and some uses little, although I'm not sure how common that is.

It should be a somewhat trivial addition to the current codebase so I think I could even add it to the next update.
Jens
23 posts / 1 project
Big endian support
1 week, 6 days ago
I just released version 0.0.3 that adds some support for byte order specification.

You can write exactly as you wrote in the original post, but you can also use `default(endianess=big)` on top block level, any definition below that statement will interpret the scalars with that byte order.