Skip to content

Instantly share code, notes, and snippets.

@jhrr
Last active November 27, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhrr/ce396e0bb9882a312f7f071df9a1f494 to your computer and use it in GitHub Desktop.
Save jhrr/ce396e0bb9882a312f7f071df9a1f494 to your computer and use it in GitHub Desktop.
static double D[M]; /* initialized to zero */
static long ptr=0; /* read-write offset */
double delayline(double x) {
double y = D[ptr]; /* read operation */
D[ptr++] = x; /* write operation */
// *(ptr++) = x; ??
if (ptr >= M) {
ptr -= M; /* wrap ptr */
}
return y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment