audio_stream: Buffer manipulation asserts

Added asserts witch helped me debug the code.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2022-01-18 15:10:01 +01:00 committed by Liam Girdwood
parent 499b4f554c
commit a892e0f66c
1 changed files with 3 additions and 0 deletions

View File

@ -228,6 +228,8 @@ static inline void *audio_stream_wrap(const struct audio_stream *buffer,
ptr = (char *)buffer->addr +
((char *)ptr - (char *)buffer->end_addr);
assert((intptr_t)ptr <= (intptr_t)buffer->end_addr);
return ptr;
}
@ -525,6 +527,7 @@ static inline int
audio_stream_bytes_without_wrap(const struct audio_stream *source,
const void *ptr)
{
assert((intptr_t)source->end_addr >= (intptr_t)ptr);
int to_end = (intptr_t)source->end_addr - (intptr_t)ptr;
return to_end;
}