Add memcpy_to_p24_from_i32
Change-Id: I695601d9cf9ffddd349e33779c761e60faf8d072
diff --git a/audio_utils/primitives.c b/audio_utils/primitives.c
index df1dc0b..254f3af 100644
--- a/audio_utils/primitives.c
+++ b/audio_utils/primitives.c
@@ -171,6 +171,23 @@
}
}
+void memcpy_to_p24_from_i32(uint8_t *dst, const int32_t *src, size_t count)
+{
+ while (count--) {
+ int32_t ival = *src++ >> 8;
+
+#ifdef HAVE_BIG_ENDIAN
+ *dst++ = ival >> 16;
+ *dst++ = ival >> 8;
+ *dst++ = ival;
+#else
+ *dst++ = ival;
+ *dst++ = ival >> 8;
+ *dst++ = ival >> 16;
+#endif
+ }
+}
+
void memcpy_to_q8_23_from_i16(int32_t *dst, const int16_t *src, size_t count)
{
while (count--) {