|
|
|
|
|
by timerol
482 days ago
|
|
Yes, but as mentioned in TFA, storing the difference would require an extra bit. The difference between two 32 bit numbers is in the range [-2^32 -1, 2^32-1], needing 33 bits to store. The XOR is the same size as the original pointer, simplifying data flow. But even so, storing a doubly linked list with only pointer differences and no absolute pointers (other than head and tail) feels illegal too |
|
No it wouldn’t. Just let wraparound happen normally and things will work out.
Effectively what you need are functions
Setting all three to XOR is one possibility. But is an equally valid one, because addition and subtraction modulo any fixed value are related in exactly the same way as normal addition and subtraction.