* See the COPYING file in the top-level directory.
*/
+#include <stdint.h>
#include "cspace.h"
/*
|| (defined(__GNUC__) && __GNUC__ >= 5)) \
&& __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
-#include <stdint.h>
#include <assert.h>
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
void bgr555_to_rgb565(void *dst_, const void *src_, int bytes)
{
- const unsigned int *src = src_;
+ // source can be misaligned, but it's very rare, so just force
+ const unsigned int *src = (const void *)((intptr_t)src_ & ~3);
unsigned int *dst = dst_;
unsigned int x, p, r, g, b;
int r0, g0, b0, r1, g1, b1;
int y0, y1, u, v;
- for (; pixels > 0; src += 2, dst++, pixels -= 2)
+ for (; pixels > 1; src += 2, dst++, pixels -= 2)
{
b0 = (src[0] >> 10) & 0x1f;
g0 = (src[0] >> 5) & 0x1f;