32/64-Bit 80x86 Assembly Language Architecture

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

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); }

 

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

void vmp_MatrixSplat(vmp3DMatrix Mx, float f) { uint n; float *pF; pF = (float *)Mx; n = 16; do { *pF = f; pF++; } while (--n); }

 

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 .

Категории