1typedef short int16_t;
2
3int round_sample(int *sum);
4
5#define MULS(ra, rb) ((ra) * (rb))
6
7#define SUM8(sum, op, w, p) \
8{ \
9  sum op MULS((w)[0 * 64], p[0 * 64]); \
10  sum op MULS((w)[1 * 64], p[1 * 64]); \
11  sum op MULS((w)[2 * 64], p[2 * 64]); \
12  sum op MULS((w)[3 * 64], p[3 * 64]); \
13  sum op MULS((w)[4 * 64], p[4 * 64]); \
14  sum op MULS((w)[5 * 64], p[5 * 64]); \
15  sum op MULS((w)[6 * 64], p[6 * 64]); \
16  sum op MULS((w)[7 * 64], p[7 * 64]); \
17}
18
19void foo(int *dither_state, int *samples)
20{
21  int16_t *synth_buf;
22  const int16_t *w, *p;
23  int sum;
24
25  sum = *dither_state;
26  p = synth_buf + 16;
27  SUM8(sum, +=, w, p);
28  p = synth_buf + 48;
29  SUM8(sum, -=, w + 32, p);
30  *samples = round_sample(&sum);
31}
32