diff options
author | Max Kellermann <max@duempel.org> | 2011-10-09 12:48:17 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-10-10 10:24:05 +0200 |
commit | a47e9d1a4b5bd6b999eaec33624d7c96a29f24e6 (patch) | |
tree | 99d1bfef2c1e739dfba50717c26ee19107e9a496 /src/pcm_pack.c | |
parent | e93dd374a46270d6cd873b7e2db557b346b1aac7 (diff) | |
download | mpd-a47e9d1a4b5bd6b999eaec33624d7c96a29f24e6.tar.gz mpd-a47e9d1a4b5bd6b999eaec33624d7c96a29f24e6.tar.xz mpd-a47e9d1a4b5bd6b999eaec33624d7c96a29f24e6.zip |
pcm_pack: pass an "end" pointer instead of a sample count
Diffstat (limited to '')
-rw-r--r-- | src/pcm_pack.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pcm_pack.c b/src/pcm_pack.c index 680d2a32f..94fda5910 100644 --- a/src/pcm_pack.c +++ b/src/pcm_pack.c @@ -35,19 +35,19 @@ pack_sample(uint8_t *dest, const int32_t *src0, bool reverse_endian) } void -pcm_pack_24(uint8_t *dest, const int32_t *src, unsigned num_samples, +pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end, bool reverse_endian) { /* duplicate loop to help the compiler's optimizer (constant parameter to the pack_sample() inline function) */ if (G_LIKELY(!reverse_endian)) { - while (num_samples-- > 0) { + while (src < src_end) { pack_sample(dest, src++, false); dest += 3; } } else { - while (num_samples-- > 0) { + while (src < src_end) { pack_sample(dest, src++, true); dest += 3; } @@ -73,19 +73,19 @@ unpack_sample(int32_t *dest0, const uint8_t *src, bool reverse_endian) } void -pcm_unpack_24(int32_t *dest, const uint8_t *src, unsigned num_samples, +pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end, bool reverse_endian) { /* duplicate loop to help the compiler's optimizer (constant parameter to the unpack_sample() inline function) */ if (G_LIKELY(!reverse_endian)) { - while (num_samples-- > 0) { + while (src < src_end) { unpack_sample(dest++, src, false); src += 3; } } else { - while (num_samples-- > 0) { + while (src < src_end) { unpack_sample(dest++, src, true); src += 3; } |