Handling different bit groupings and alignments #104
scholarsmate
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The user needs to be allowed to select bits from the physical display at whatever bit offset they'd like, then edit them, deleting, inserting, and overwriting as usual.
The editor should provide different bit groupings, like 7, 6, or 5 bit groupings, and be able to order the bit groupings by most significant bit first or least significant bit first. The user can toggle the bits (overwrite), and insert and delete bits.
At commit time, if the number of edited bits is not evenly divisible by 8, then we have to deal with alignment. If there is a remainder after dividing the number of bits by 8, then to commit that change, it will affect all the bytes after that change, shifting bits right by the remainder, until we get to the last byte, which must be filled with 8 - remainder bits. When committing an unaligned edit, the user should be asked to supply the bits to fill the last byte with since the physical representation itself must be 8-bit aligned so it can be saved to file.
On unaligned commits, all the bytes after the edit will change. This can be a big change if the file itself is large. Ωedit can efficiently handle massive file transformations, like this one, using its checkpoint feature with a file transform. This combination has been tested by transforming ASCII character case to upper or lower case on large files using a checkpoint and a file transformation function and the changes can be undone and redone as a single transaction. All the necessary shifting, bit twiddling, and last byte fill necessary to handle and unaligned edit can be done efficiently as a file transform in Ωedit.
When the user cuts into a series of bytes at a bit offset, the DE should enter into a different editing mode for binary cuts, where we no longer have the Data Inspector nor the Logical View. We just have the Physical view and a special editor view that will be in a binary mode, with some special controls for bit groupings, and bit orderings, and handling at Commit time for dealing with the last byte fill when the edit is unaligned.
Beta Was this translation helpful? Give feedback.
All reactions