mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
intreadwrite.h: disable optimizations
Disable arch/compiler specific optimizations in the MPlayer version of intreadwrite.h. All the uses in MPlayer should be irrelevant for performance.
This commit is contained in:
parent
5266b5de98
commit
e3103ea06f
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MP_AVUTIL_ARM_INTREADWRITE_H
|
||||
#define MP_AVUTIL_ARM_INTREADWRITE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM
|
||||
|
||||
#define AV_RN16 AV_RN16
|
||||
static inline uint16_t AV_RN16(const void *p)
|
||||
{
|
||||
uint16_t v;
|
||||
__asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
|
||||
return v;
|
||||
}
|
||||
|
||||
#define AV_WN16 AV_WN16
|
||||
static inline void AV_WN16(void *p, uint16_t v)
|
||||
{
|
||||
__asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v));
|
||||
}
|
||||
|
||||
#define AV_RN32 AV_RN32
|
||||
static inline uint32_t AV_RN32(const void *p)
|
||||
{
|
||||
uint32_t v;
|
||||
__asm__ ("ldr %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));
|
||||
return v;
|
||||
}
|
||||
|
||||
#define AV_WN32 AV_WN32
|
||||
static inline void AV_WN32(void *p, uint32_t v)
|
||||
{
|
||||
__asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
|
||||
}
|
||||
|
||||
#define AV_RN64 AV_RN64
|
||||
static inline uint64_t AV_RN64(const void *p)
|
||||
{
|
||||
union { uint64_t v; uint32_t hl[2]; } v;
|
||||
__asm__ ("ldr %0, %2 \n\t"
|
||||
"ldr %1, %3 \n\t"
|
||||
: "=r"(v.hl[0]), "=r"(v.hl[1])
|
||||
: "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1)));
|
||||
return v.v;
|
||||
}
|
||||
|
||||
#define AV_WN64 AV_WN64
|
||||
static inline void AV_WN64(void *p, uint64_t v)
|
||||
{
|
||||
union { uint64_t v; uint32_t hl[2]; } vv = { v };
|
||||
__asm__ ("str %2, %0 \n\t"
|
||||
"str %3, %1 \n\t"
|
||||
: "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
|
||||
: "r"(vv.hl[0]), "r"(vv.hl[1]));
|
||||
}
|
||||
|
||||
#endif /* HAVE_INLINE_ASM */
|
||||
|
||||
#endif /* AVUTIL_ARM_INTREADWRITE_H */
|
@ -23,46 +23,6 @@
|
||||
#include "config.h"
|
||||
#include "bswap.h"
|
||||
|
||||
/*
|
||||
* Arch-specific headers can provide any combination of
|
||||
* AV_[RW][BLN](16|32|64) macros. Preprocessor symbols must be
|
||||
* defined, even if these are implemented as inline functions.
|
||||
*/
|
||||
|
||||
#if ARCH_ARM
|
||||
# include "arm/intreadwrite.h"
|
||||
#elif ARCH_MIPS
|
||||
# include "mips/intreadwrite.h"
|
||||
#elif ARCH_PPC
|
||||
# include "ppc/intreadwrite.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define AV_[RW]N helper macros to simplify definitions not provided
|
||||
* by per-arch headers.
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
struct unaligned_64 { uint64_t l; } __attribute__((packed));
|
||||
struct unaligned_32 { uint32_t l; } __attribute__((packed));
|
||||
struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
|
||||
# define AV_RN(s, p) (((const struct unaligned_##s *) (p))->l)
|
||||
# define AV_WN(s, p, v) (((struct unaligned_##s *) (p))->l) = (v)
|
||||
|
||||
#elif defined(__DECC)
|
||||
|
||||
# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
|
||||
# define AV_WN(s, p, v) *((__unaligned uint##s##_t*)(p)) = (v)
|
||||
|
||||
#elif HAVE_FAST_UNALIGNED
|
||||
|
||||
# define AV_RN(s, p) (*((const uint##s##_t*)(p)))
|
||||
# define AV_WN(s, p, v) *((uint##s##_t*)(p)) = (v)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef AV_RB16
|
||||
#define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | \
|
||||
((const uint8_t*)(x))[1])
|
||||
@ -163,8 +123,6 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
# define AV_WN(s, p, v) AV_WL##s(p, v)
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_FAST_UNALIGNED */
|
||||
|
||||
#ifndef AV_RN16
|
||||
# define AV_RN16(p) AV_RN(16, p)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user