Test Jigs

One sometimes needs data to load vector algorithms during testing. These functions may seem downright silly but they do come in handy from time to time.

Matrix Test Fill

The following function does just that. It fills a matrix with a sequential set of single-precision floating-point whole numbers . This helps to keep the floating-point stored in memory in a recognizable form when just doing a memory dump.

Listing 21-7: ...\chap20\vecBug\vecBug.cpp
image from book
 void vmp_MatrixTestFill(vmp3DMatrix Mx) {   uint n;   float *pF, f;       f = 0.0f;             // Starting value of 0.0f   pF = (float *)Mx;   n = 16;       do {     *pF = f;     f += 1.0f;          // Advance value by 1.0f     pF++;   } while (--n); } 
image from book

Matrix Splat

This function splats (replicates) a single-precision floating-point value into all sixteen elements of a matrix.

Listing 21-8: ...\chap20\vecBug\vecBug.cpp
image from book
 void vmp_MatrixSplat(vmp3DMatrix Mx, float f) {   uint n;   float *pF;       pF = (float *)Mx;   n = 16;       do {     *pF = f;     pF++;   } while (--n); } 
image from book

There are other functions and test jigs for use in the debugging of vector code that are available for purchase from middleware providers. They are also something to be developed from your imagination .

32.64-Bit 80X86 Assembly Language Architecture
32/64-Bit 80x86 Assembly Language Architecture
ISBN: 1598220020
EAN: 2147483647
Year: 2003
Pages: 191

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net