diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-04-22 22:20:13 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-04-22 22:20:13 +0000 |
commit | 89fa345e9ee4778b5f0391b5ab1cfc043aadc1d9 (patch) | |
tree | f92b98e1686a7424a476bc20e6ee37ab3aa971dc /qbufsplit.c | |
parent | 783b56d54788f177881d68ae2ec7a7cb4bb38ac4 (diff) |
git-svn-id: file:///home/lennart/svn/public/vfax/trunk@4 541b366f-4dd8-0310-ae39-b2612fd50714
Diffstat (limited to 'qbufsplit.c')
-rw-r--r-- | qbufsplit.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/qbufsplit.c b/qbufsplit.c new file mode 100644 index 0000000..e03d1a3 --- /dev/null +++ b/qbufsplit.c @@ -0,0 +1,33 @@ +#include <assert.h> + +#include "qbufsplit.h" + +void qbuf_float_split(struct qbuf* sq, struct qbuf* dq1, struct qbuf*dq2) { + float *sp, *dp1, *dp2; + size_t sl, dl1, dl2; + size_t c = 0; + + assert(sq && dq1 && dq2); + + sp = qbuf_pull(sq, &sl); + dp1 = qbuf_push(dq1, &dl1); + dp2 = qbuf_push(dq2, &dl2); + + assert(sp && dp1 && dp2); + + while (sl >= 2*sizeof(float) && dl1 >= sizeof(float) && dl2 >= sizeof(float)) { + + *(dp1++) = *(sp++); + *(dp2++) = *(sp++); + + sl -= 2*sizeof(float); + dl1 -= sizeof(float); + dl2 -= sizeof(float); + + c += sizeof(float); + } + + qbuf_pull_invalidate(sq, c*2); + qbuf_push_validate(dq1, c); + qbuf_push_validate(dq2, c); +} |