From 507aaf98de47ca11c52ced9957d4f190aff71777 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 5 Dec 2010 22:51:00 +0200 Subject: [PATCH] fix some alignment issues --- libpcsxcore/misc.c | 4 +++- plugins/dfxvideo/swap.h | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index ef492440..38a516cd 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -54,7 +54,9 @@ struct iso_directory_record { void mmssdd( char *b, char *p ) { int m, s, d; -#if defined(__BIGENDIAN__) +#if defined(__arm__) + int block = (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]; +#elif defined(__BIGENDIAN__) int block = (b[0] & 0xff) | ((b[1] & 0xff) << 8) | ((b[2] & 0xff) << 16) | (b[3] << 24); #else int block = *((int*)b); diff --git a/plugins/dfxvideo/swap.h b/plugins/dfxvideo/swap.h index 3f7ac21d..e5597598 100644 --- a/plugins/dfxvideo/swap.h +++ b/plugins/dfxvideo/swap.h @@ -64,8 +64,13 @@ static __inline__ void PUTLE32(uint32_t *ptr, uint32_t val) { #else #define GETLE16(X) LE2HOST16(*(uint16_t *)X) -#define GETLE32(X) LE2HOST32(*(uint32_t *)X) #define GETLE16D(X) ({uint32_t val = GETLE32(X); (val<<16 | val >> 16);}) #define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0) +#ifdef __arm__ +#define GETLE32(X) (*(uint16_t *)X|(((uint16_t *)X)[1]<<16)) +#define PUTLE32(X, Y) do{*((uint16_t *)X)=(uint32_t)Y;((uint16_t *)X)[1]=(uint32_t)(Y)>>16;}while(0) +#else +#define GETLE32(X) LE2HOST32(*(uint32_t *)X) #define PUTLE32(X, Y) do{*((uint32_t *)X)=HOST2LE16((uint32_t)Y);}while(0) #endif +#endif -- 2.39.5