Hacker News new | ask | show | jobs
by benkuykendall 806 days ago
I couldn't really understand this paragraph. Maybe I need a worked example?

> Bit rotation can be implemented using a combination of bit shifting and or operations, and on a hardware level, with different locical XOR ports. That’s of course just one way, and you still need a way to identify the number without confusing it with another figure. Although I don’t think that last was implemented: if you select your starting bits in a smart way, there won’t be any overlap. The identification system here uses 14 bits, and all of the figures have either 6 or 7 1s, making it even possible to completely ignore bit rotation and just rely on the relative position of the enabled bits to do the identification. I’m of course merely guessing at this point.

Not sure what it means to "completely ignore bit rotation" and "just rely on the relative position of the enabled bits", those sound like the same thing to me.

To throw my speculation out there, I wonder if this is just done with a lookup table. If we use a byte (generous) to identify each figure, then a table indexed by all 2^14 bit patterns will take less than 17kb. No need to do anything more clever.

1 comments

I think the codes follow the pattern 1111110xxxxxxx. 1111110 is the header, and xxxxxxx is the data. The program rotates the bit string until the first seven bits match the header. This always produces the same data because there isn't a 14-bit string that can be rotated in multiple ways to have 1111110 as the header but different data.