-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In order for the logical ops to make sense (especially in light of indexing or modifying individual bits), we have to specify how indexes correspond to bits in a BuiltinByteString. In an ideal world, we would have it that for any bit index i, that bit would be at the quot i 8th byte index of a BuiltinByteString: that is, we would have both bit and byte indexes 'agree'. However, this turns out to actually be far from ideal: the bits in a byte are indexed right-to-left, as a byte represents a number in base-2, and numbers are read right-to-left in order of significance. Thus, the 'agreement' scheme above would complicate many operations, including future operations like shifts and rotations, as well as make them much slower.
Instead, we propose a 'right-to-left' scheme, which essentially agrees with bit ordering, and puts the index-0 bit at the end of the last byte. The diagram below demonstrates this.
This scheme needs to be described clearly, ideally with examples.
