Skip to content

Handle big endian bitfields correctly

Jerry James requested to merge jjames/blueprint-compiler:main into main

Fixes #96 (closed).

On big endian architectures, bitfields are in reverse order from little endian architectures. That is, if a 1-bit field is first textually, it is the least significant bit on little endian architecture and the most significant bit on big endian architectures. This commit changes some calculations to compute the correct shifts on big endian architectures.

Also, OBJ_GTYPE_STRUCT had the wrong offset. It doesn't seem to be used at present, but it should be fixed in case it is used in the future.

Finally, the signed flag wasn't passed to int.from_bytes. That also doesn't seem to matter at present, but should be fixed for possible future use.

Merge request reports