Homerun?
Problem 7A test
engineer has just given you a report indicating that the output of
a DAC has a slight phase jitter. The engineer suspects this code fragment
is the culprit, but you know the lookup table entries have already
been loaded correctly. Can you identify the problem with this information?
#define TABSIZ 257
static short dac_sine_val[TABSIZ];
short dac_value(void) {
static unsigned short ix=0;
return (dac_sine_val[ ix++ % TABSIZ ]);
}
ANSWER

Problem 8The following
function will evaluate an order-n polynomial for value x. By inspection,
you can see that the function will perform 2n multiplications for
an order-n polynomial. Can you significantly reduce the number of
multipilcation operations required by this function?
float evalpoly(float x, float *coeff, int order) {
float sum, xprod;
int i;
xprod = 1.0; sum = 0.0;
for (i=0; i<order; i++) {
sum += coeff[i] * xprod;
xprod *= x;
}
return (sum);
}
ANSWER 
11--99
|