Lines 1-12
Link Here
|
1 |
#ifndef _SD_GET_UINT32_H_ |
1 |
#ifndef _SD_GET_UINT32_H_ |
2 |
#define _SD_GET_UINT32_H_ |
2 |
#define _SD_GET_UINT32_H_ |
|
|
3 |
#if defined(ARM) || defined(__sparc__) |
4 |
#include <string.h> |
5 |
#endif |
3 |
|
6 |
|
4 |
#ifdef ARM |
7 |
#if defined(ARM) || defined(__sparc__) |
5 |
static inline guint32 get_uint32(const gchar *addr) |
8 |
static inline guint32 get_uint32(const gchar *addr) |
6 |
{ |
9 |
{ |
7 |
guint32 result; |
10 |
if (((addr - (char *)0) & 3) == 0) { |
8 |
memcpy(&result, addr, sizeof(guint32)); |
11 |
/* already aligned properly */ |
9 |
return result; |
12 |
return *reinterpret_cast<const guint32 *>(addr); |
|
|
13 |
} else { |
14 |
guint32 result; |
15 |
memcpy(&result, addr, sizeof(guint32)); |
16 |
return result; |
17 |
} |
10 |
} |
18 |
} |
11 |
#else |
19 |
#else |
12 |
#define get_uint32(x) *reinterpret_cast<const guint32 *>(x) |
20 |
#define get_uint32(x) *reinterpret_cast<const guint32 *>(x) |