add unaligned16() and unaligned64()
Originally committed as revision 5366 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
e1203ac098
commit
b8d10977f4
@ -141,25 +141,34 @@ typedef struct RL_VLC_ELEM {
|
|||||||
|
|
||||||
/* used to avoid missaligned exceptions on some archs (alpha, ...) */
|
/* used to avoid missaligned exceptions on some archs (alpha, ...) */
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
||||||
|
# define unaligned16(a) (*(const uint16_t*)(a))
|
||||||
# define unaligned32(a) (*(const uint32_t*)(a))
|
# define unaligned32(a) (*(const uint32_t*)(a))
|
||||||
|
# define unaligned64(a) (*(const uint64_t*)(a))
|
||||||
#else
|
#else
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
static inline uint32_t unaligned32(const void *v) {
|
# define unaligned(x) \
|
||||||
struct Unaligned {
|
static inline uint##x##_t unaligned##x(const void *v) { \
|
||||||
uint32_t i;
|
struct Unaligned { \
|
||||||
} __attribute__((packed));
|
uint##x##_t i; \
|
||||||
|
} __attribute__((packed)); \
|
||||||
return ((const struct Unaligned *) v)->i;
|
\
|
||||||
|
return ((const struct Unaligned *) v)->i; \
|
||||||
}
|
}
|
||||||
# elif defined(__DECC)
|
# elif defined(__DECC)
|
||||||
static inline uint32_t unaligned32(const void *v) {
|
# define unaligned(x) \
|
||||||
return *(const __unaligned uint32_t *) v;
|
static inline uint##x##_t unaligned##x##(const void *v) { \
|
||||||
|
return *(const __unaligned uint##x##_t *) v; \
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
static inline uint32_t unaligned32(const void *v) {
|
# define unaligned(x) \
|
||||||
return *(const uint32_t *) v;
|
static inline uint##x##_t unaligned##x##(const void *v) { \
|
||||||
|
return *(const uint##x##_t *) v; \
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
unaligned(16)
|
||||||
|
unaligned(32)
|
||||||
|
unaligned(64)
|
||||||
|
#undef unaligned
|
||||||
#endif //!ARCH_X86
|
#endif //!ARCH_X86
|
||||||
|
|
||||||
#ifndef ALT_BITSTREAM_WRITER
|
#ifndef ALT_BITSTREAM_WRITER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user