Revert "Use <endian.h>"
This reverts commit 2c69c5a37a233ff064ea1571beb39902d14771d6.
Change-Id: I89d8a43339a43e2f1b840a0488cc06239d6c900a
diff --git a/audio_utils/primitives.c b/audio_utils/primitives.c
index 664c095..254f3af 100644
--- a/audio_utils/primitives.c
+++ b/audio_utils/primitives.c
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-#include <endian.h>
#include <cutils/bitops.h> /* for popcount() */
#include <audio_utils/primitives.h>
#include "private/private.h"
@@ -102,7 +101,7 @@
void memcpy_to_i16_from_p24(int16_t *dst, const uint8_t *src, size_t count)
{
while (count--) {
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = src[1] | (src[0] << 8);
#else
*dst++ = src[1] | (src[2] << 8);
@@ -114,7 +113,7 @@
void memcpy_to_i32_from_p24(int32_t *dst, const uint8_t *src, size_t count)
{
while (count--) {
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = (src[2] << 8) | (src[1] << 16) | (src[0] << 24);
#else
*dst++ = (src[0] << 8) | (src[1] << 16) | (src[2] << 24);
@@ -126,7 +125,7 @@
void memcpy_to_p24_from_i16(uint8_t *dst, const int16_t *src, size_t count)
{
while (count--) {
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = *src >> 8;
*dst++ = *src++;
*dst++ = 0;
@@ -143,7 +142,7 @@
while (count--) {
int32_t ival = clamp24_from_float(*src++);
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = ival >> 16;
*dst++ = ival >> 8;
*dst++ = ival;
@@ -160,7 +159,7 @@
while (count--) {
int32_t ival = clamp24_from_q8_23(*src++);
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = ival >> 16;
*dst++ = ival >> 8;
*dst++ = ival;
@@ -177,7 +176,7 @@
while (count--) {
int32_t ival = *src++ >> 8;
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = ival >> 16;
*dst++ = ival >> 8;
*dst++ = ival;
@@ -206,7 +205,7 @@
void memcpy_to_q8_23_from_p24(int32_t *dst, const uint8_t *src, size_t count)
{
while (count--) {
-#if _BYTE_ORDER == _BIG_ENDIAN
+#ifdef HAVE_BIG_ENDIAN
*dst++ = (int8_t)src[0] << 16 | src[1] << 8 | src[2];
#else
*dst++ = (int8_t)src[2] << 16 | src[1] << 8 | src[0];