zipdig ucb 9 4 7 2 0 define ucount 3 int

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: h+(20*index) IA32 Code —༉  —༉  Computes and returns address Compute as pgh + 4*(index+4*index) 12 NESTED ARRAY ROW ACCESS ¢༊  Array Elements —༉  —༉  A[i][j] is element of type T, which requires K bytes Address A + i * (C * K) + j * K = A + (i * C + j)* K int A[R][C]; A[0] A [0] [0] A • • • A[i] A [0] [C-1] • • • A • • • [ i ] • • • [j] A[R-1] A • • • [R-1] [0] A+(i*C*4) A+(i*C*4)+(j*4) • • • A [R-1] [C-1] A+((R-1)*C*4) 13 NESTED ARRAY ELEMENT ACCESS CODE int get_pgh_digit (int index, int dig) { return pgh[index][dig]; } movl leal addl movl ¢༊  # # # # index 5*index 5*index+dig offset 4*(5*index+dig) Array Elements —༉  —༉  pgh[index][dig] is int Address: pgh + 20*index + 4*dig ¢༊  ¢༊  8(%ebp), %eax (%eax,%eax,4), %eax 12(%ebp), %eax pgh(,%eax,4), %eax = pgh + 4*(5*index + dig) IA32 Code —༉  Computes address pgh + 4*((index+4*index)+dig) 14 MULTI- LEVEL ARRAY EXAMPLE zip_dig cmu = { 1, 5,...
View Full Document

Ask a homework question - tutors are online