Page 188 - ARM 64 Bit Assembly Language
P. 188

Abstract data types 175





































                                    Figure 6.3: Binary tree of word frequencies with sorted index.




                    9         .equ   wl_nwords,      0      // number of words in list
                   10         .equ   wl_head,        8      // head of linked list
                   11         .equ   wl_size,       16      // sizeof(wordlist)
                   12  ### Define NULL
                   13         .equ   NULL,           0
                   14         .data
                   15  failstr:.asciz  "Unable to allocate index\n"
                   16  fmtstr: .asciz  "%10d ’%s’\n"
                   17         .text
                   18  ### ----------------------------------------------------------
                   19  ### Recursively traverses the tree, filling in the array of
                   20  ### pointers.
                   21  ### wordlistnode **getptrs(wordlistnode *ptrs[], wordlistnode *node)
                   22         .type  getptrs, %function
                   23  getptrs:
                   24         cmp    x1, #0                 // if (node == NULL)
                   25         beq    getptrs_exit           // return ptrs;
                   26         stp    x29, x30, [sp, #-32]!
                   27         str    x19, [sp, #16]
   183   184   185   186   187   188   189   190   191   192   193