aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/bitstream.h
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2006-05-11 23:17:23 +0000
committerMåns Rullgård <mans@mansr.com>2006-05-11 23:17:23 +0000
commitb8d10977f435ef7de6a90c8545a419192b8e83c6 (patch)
tree49d962de539999d99e354ca4c1fd990c9b162d7a /libavcodec/bitstream.h
parente1203ac0985e592fac2094f8baf85f46b399ef2b (diff)
downloadffmpeg-b8d10977f435ef7de6a90c8545a419192b8e83c6.tar.gz
add unaligned16() and unaligned64()
Originally committed as revision 5366 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/bitstream.h')
-rw-r--r--libavcodec/bitstream.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
index b425049900..195bcc7a18 100644
--- a/libavcodec/bitstream.h
+++ b/libavcodec/bitstream.h
@@ -141,25 +141,34 @@ typedef struct RL_VLC_ELEM {
/* used to avoid missaligned exceptions on some archs (alpha, ...) */
#if defined(ARCH_X86) || defined(ARCH_X86_64)
+# define unaligned16(a) (*(const uint16_t*)(a))
# define unaligned32(a) (*(const uint32_t*)(a))
+# define unaligned64(a) (*(const uint64_t*)(a))
#else
# ifdef __GNUC__
-static inline uint32_t unaligned32(const void *v) {
- struct Unaligned {
- uint32_t i;
- } __attribute__((packed));
-
- return ((const struct Unaligned *) v)->i;
+# define unaligned(x) \
+static inline uint##x##_t unaligned##x(const void *v) { \
+ struct Unaligned { \
+ uint##x##_t i; \
+ } __attribute__((packed)); \
+ \
+ return ((const struct Unaligned *) v)->i; \
}
# elif defined(__DECC)
-static inline uint32_t unaligned32(const void *v) {
- return *(const __unaligned uint32_t *) v;
+# define unaligned(x) \
+static inline uint##x##_t unaligned##x##(const void *v) { \
+ return *(const __unaligned uint##x##_t *) v; \
}
# else
-static inline uint32_t unaligned32(const void *v) {
- return *(const uint32_t *) v;
+# define unaligned(x) \
+static inline uint##x##_t unaligned##x##(const void *v) { \
+ return *(const uint##x##_t *) v; \
}
# endif
+unaligned(16)
+unaligned(32)
+unaligned(64)
+#undef unaligned
#endif //!ARCH_X86
#ifndef ALT_BITSTREAM_WRITER