Then declaring these two elds as part of a union

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: ode operating on multi-dimensional arrays of fixed size. For example, suppose we declare data type fix_matrix to be ½ ¢ ½ arrays of integers as follows: 1 2 #define N 16 typedef int fix_matrix[N][N]; The code in Figure 3.23(a) computes element of the product of matrices A and B. The C compiler generates code similar to that shown in Figure 3.23(b). This code contains a number of clever optimizations. It recognizes that the loop will access the elements of array A as A[i][0], A[i][1], . . . , A[i][15] in sequence. These elements occupy adjacent positions in memory starting with the address of array element A[i][0]. The program can therefore use a pointer variable Aptr to access these successive locations. The loop will access the elements of array B as B[0][k], B[1][k], . . . , B[15][k] in sequence. These elements occupy positions in memory starting with the address of array element B[0][k] and spaced 64 bytes apart. The program can therefore use a pointer variable Bptr to access these successive locations. In C, this pointer is shown as being incremented by 16, although in fact the actual pointer is incremented by...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online