aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-19 22:11:50 +0200
committerMax Kellermann <max@duempel.org>2011-10-19 22:13:23 +0200
commit0debe9bd6ffb6f89a0756137837dcdc58fa84de0 (patch)
treee54d9c8ca9f163cc9983d78c439d83972129ed66 /src/pcm_utils.h
parentf1da118a6ccec6154a8e67c78d52fffb2ffa7089 (diff)
downloadmpd-0debe9bd6ffb6f89a0756137837dcdc58fa84de0.tar.gz
mpd-0debe9bd6ffb6f89a0756137837dcdc58fa84de0.tar.xz
mpd-0debe9bd6ffb6f89a0756137837dcdc58fa84de0.zip
pcm_utils: add function pcm_end_pointer()
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pcm_utils.h b/src/pcm_utils.h
index b6a6f3787..001423b37 100644
--- a/src/pcm_utils.h
+++ b/src/pcm_utils.h
@@ -25,6 +25,17 @@
#include <stdint.h>
/**
+ * Add a byte count to the specified pointer. This is a utility
+ * function to convert a source pointer and a byte count to an "end"
+ * pointer for use in loops.
+ */
+static inline const void *
+pcm_end_pointer(const void *p, size_t size)
+{
+ return (const char *)p + size;
+}
+
+/**
* Check if the value is within the range of the provided bit size,
* and caps it if necessary.
*/