Share via


_XDXform4dV (Windows CE 5.0)

Send Feedback

Multiplies a four-dimensional vector by a 4x4 matrix. This instruction requires that the matrix has been previously loaded into the extended floating-point register bank.

float* _XDXform4dV(   float* src,   float* dst);

Parameters

  • src
    [in] Pointer to a three-dimensional source vector.
  • dst
    [out] Pointer to a three-dimensional destination vector.

Return Values

Pointer to the four-dimensional destination vector.

Remarks

The following code shows how to use _XDXform4dV.

#pragma intrinsic(_XDXform4dV, _LoadMatrix)
void print_matrix(float *matrix, float *src, float *dest)
{
       int row, col;
       printf("Matrix:\t\t\t\tSrc:\tDest:\n");

       for (row = 0; row < 4; row++)
    {
           printf("| ");
           for (col = 0; col < 4; col++)
             printf("%6.2f", *matrix++);
           printf(" |");
           printf(" |%6.2f|", *src++);
           printf("\t|%10.4f|\n", *dest++);
       }
}

void main()
{
       int i;
       float dest[8];

   float src[8] =    {1.0, 2.0 ,3.0, 4.0,
               5.0, 6.0, 7.0, 8.0};

   float matrix[16]={  1.0,  2.0,  3.0,   4.0,
                  5.0,  6.0,  7.0,   8.0,
                  9.0,  10.0,    11.0, 12.0,
                  13.0, 14.0,    15.0, 16.0};

   LoadMatrix(matrix);       //Load matrix into XD bank registers

       for (i = 0;  i < 8;  i +=4)
         XDXform4dV(src+i, dest+i);     //[matrix]x[src[i]] --> dest[i]

       print_matrix(matrix, src, dest);
       printf("\n");
       print_matrix(matrix, src+4, dest+4);
}
Output
Matrix:                         Src:         Dest:
|   1.00 2.00   3.00 4.00 |    |  1.00 |    |  30.0000|
|   5.00 6.00   7.00 8.00 |    |  2.00 |    |  70.0000|
|   9.00 10.00 11.00 12.00 |   |  3.00 |    |  110.0000|
|  13.00 14.00 15.00 16.00 |   |  4.00 |    |  150.0000|
Matrix:                          Src:        Dest:
|  1.00   2.00  3.00  4.00 |    |  5.00|    |   70.0000|
|  5.00   6.00  7.00  8.00 |    |  6.00|    |  174.0000|
|  9.00    10.00 11.00 12.00 |   |  7.00|    |  278.0000|
|  13.00 14.00 15.00 16.00 |    |  8.00|    |  382.0000|

Requirements

Header: shintr.h.

See Also

Intrinsic Functions for Renesas Microprocessors | _Xform3dV | _Xform4dV | _LoadMatrix | _SaveMatrix

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.