Browse code

AVR32: inline asm for bswap.h

Originally committed as revision 19664 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2009/08/17 09:15:51
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,44 @@
0
+/*
1
+ * This file is part of FFmpeg.
2
+ *
3
+ * FFmpeg is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * FFmpeg is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with FFmpeg; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#ifndef AVUTIL_AVR32_BSWAP_H
19
+#define AVUTIL_AVR32_BSWAP_H
20
+
21
+#include <stdint.h>
22
+#include "config.h"
23
+#include "libavutil/common.h"
24
+
25
+#if HAVE_INLINE_ASM
26
+
27
+#define bswap_16 bswap_16
28
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
29
+{
30
+    __asm__ ("swap.bh %0" : "+r"(x));
31
+    return x;
32
+}
33
+
34
+#define bswap_32 bswap_32
35
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
36
+{
37
+    __asm__ ("swap.b  %0" : "+r"(x));
38
+    return x;
39
+}
40
+
41
+#endif /* HAVE_INLINE_ASM */
42
+
43
+#endif /* AVUTIL_AVR32_BSWAP_H */
... ...
@@ -32,6 +32,8 @@
32 32
 
33 33
 #if   ARCH_ARM
34 34
 #   include "arm/bswap.h"
35
+#elif ARCH_AVR32
36
+#   include "avr32/bswap.h"
35 37
 #elif ARCH_BFIN
36 38
 #   include "bfin/bswap.h"
37 39
 #elif ARCH_SH4