2 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef AVUTIL_TOMI_INTREADWRITE_H
22 #define AVUTIL_TOMI_INTREADWRITE_H
27 #include "libavutil/attributes.h"
29 #define AV_RB16 AV_RB16
30 static av_always_inline uint16_t AV_RB16(const void *p)
33 __asm__ ("loadacc, (%1+) \n\t"
42 #define AV_WB16 AV_WB16
43 static av_always_inline void AV_WB16(void *p, uint16_t v)
45 __asm__ volatile ("loadacc, %1 \n\t"
47 "storeacc, (%0+) \n\t"
49 "storeacc, (%0+) \n\t"
53 #define AV_RL16 AV_RL16
54 static av_always_inline uint16_t AV_RL16(const void *p)
57 __asm__ ("loadacc, (%1+) \n\t"
66 #define AV_WL16 AV_WL16
67 static av_always_inline void AV_WL16(void *p, uint16_t v)
69 __asm__ volatile ("loadacc, %1 \n\t"
70 "storeacc, (%0+) \n\t"
72 "storeacc, (%0+) \n\t"
76 #define AV_RB32 AV_RB32
77 static av_always_inline uint32_t AV_RB32(const void *p)
80 __asm__ ("loadacc, (%1+) \n\t"
98 #define AV_WB32 AV_WB32
99 static av_always_inline void AV_WB32(void *p, uint32_t v)
101 __asm__ volatile ("loadacc, #4 \n\t"
104 "storeacc, (-%0) \n\t"
106 "storeacc, (-%0) \n\t"
108 "storeacc, (-%0) \n\t"
110 "storeacc, (-%0) \n\t"
111 : "+&a"(p) : "r"(v));
114 #define AV_RL32 AV_RL32
115 static av_always_inline uint32_t AV_RL32(const void *p)
118 __asm__ ("loadacc, (%1+) \n\t"
120 "loadacc, (%1+) \n\t"
123 "loadacc, (%1+) \n\t"
127 "loadacc, (%1+) \n\t"
136 #define AV_WL32 AV_WL32
137 static av_always_inline void AV_WL32(void *p, uint32_t v)
139 __asm__ volatile ("loadacc, %1 \n\t"
140 "storeacc, (%0+) \n\t"
142 "storeacc, (%0+) \n\t"
144 "storeacc, (%0+) \n\t"
146 "storeacc, (%0+) \n\t"
147 : "+&a"(p) : "r"(v));
150 #endif /* AVUTIL_TOMI_INTREADWRITE_H */