XOR Linked List - Features

Features

  • Given only one list item, one cannot immediately obtain the addresses of the other elements of the list.
  • Two XOR operations suffice to do the traversal from one item to the next, the same instructions sufficing in both cases. Consider a list with items {…B C D…} and with R1 and R2 being registers containing, respectively, the address of the current (say C) list item and a work register containing the XOR of the current address with the previous address (say C⊕D). Cast as System/360 instructions:
X R2,Link R2 <- C⊕D ⊕ B⊕D (i.e. B⊕C, "Link" being the link field in the current record, containing B⊕D) XR R1,R2 R1 <- C ⊕ B⊕C (i.e. B, voilà: the next record)
  • End of list is signified by imagining a list item at address zero placed adjacent to an end point, as in {0 A B C…}. The link field at A would be 0⊕B. An additional instruction is needed in the above sequence after the two XOR operations to detect a zero result in developing the address of the current item,
  • A list end point can be made reflective by making the link pointer be zero. A zero pointer is a mirror. (The XOR of the left and right neighbor addresses, being the same, is zero.)

Read more about this topic:  XOR Linked List

Famous quotes containing the word features:

    Art is the child of Nature; yes,
    Her darling child, in whom we trace
    The features of the mother’s face,
    Her aspect and her attitude.
    Henry Wadsworth Longfellow (1807–1882)

    However much we may differ in the choice of the measures which should guide the administration of the government, there can be but little doubt in the minds of those who are really friendly to the republican features of our system that one of its most important securities consists in the separation of the legislative and executive powers at the same time that each is acknowledged to be supreme, in the will of the people constitutionally expressed.
    Andrew Jackson (1767–1845)

    It is a tribute to the peculiar horror of contemporary life that it makes the worst features of earlier times—the stupefaction of the masses, the obsessed and driven lives of the bourgeoisie—seem attractive by comparison.
    Christopher Lasch (b. 1932)