summaryrefslogtreecommitdiffstats
path: root/audio/audio_int.h
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio_int.h')
-rw-r--r--audio/audio_int.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 428a091d05..71be162271 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -266,6 +266,19 @@ static inline size_t audio_ring_dist(size_t dst, size_t src, size_t len)
return (dst >= src) ? (dst - src) : (len - src + dst);
}
+/**
+ * audio_ring_posb() - returns new position in ringbuffer in backward
+ * direction at given distance
+ *
+ * @pos: current position in ringbuffer
+ * @dist: distance in ringbuffer to walk in reverse direction
+ * @len: size of ringbuffer
+ */
+static inline size_t audio_ring_posb(size_t pos, size_t dist, size_t len)
+{
+ return pos >= dist ? pos - dist : len - dist + pos;
+}
+
#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
#ifdef DEBUG