diff libavutil/arm/intreadwrite.h @ 2:897f711a7157

rearrange to work with autoconf
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 25 Sep 2012 15:55:33 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libavutil/arm/intreadwrite.h	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,78 @@
     1.4 +/*
     1.5 + * This file is part of FFmpeg.
     1.6 + *
     1.7 + * FFmpeg is free software; you can redistribute it and/or
     1.8 + * modify it under the terms of the GNU Lesser General Public
     1.9 + * License as published by the Free Software Foundation; either
    1.10 + * version 2.1 of the License, or (at your option) any later version.
    1.11 + *
    1.12 + * FFmpeg is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 + * Lesser General Public License for more details.
    1.16 + *
    1.17 + * You should have received a copy of the GNU Lesser General Public
    1.18 + * License along with FFmpeg; if not, write to the Free Software
    1.19 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    1.20 + */
    1.21 +
    1.22 +#ifndef AVUTIL_ARM_INTREADWRITE_H
    1.23 +#define AVUTIL_ARM_INTREADWRITE_H
    1.24 +
    1.25 +#include <stdint.h>
    1.26 +#include "config.h"
    1.27 +
    1.28 +#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM
    1.29 +
    1.30 +#define AV_RN16 AV_RN16
    1.31 +static av_always_inline uint16_t AV_RN16(const void *p)
    1.32 +{
    1.33 +    uint16_t v;
    1.34 +    __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
    1.35 +    return v;
    1.36 +}
    1.37 +
    1.38 +#define AV_WN16 AV_WN16
    1.39 +static av_always_inline void AV_WN16(void *p, uint16_t v)
    1.40 +{
    1.41 +    __asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v));
    1.42 +}
    1.43 +
    1.44 +#define AV_RN32 AV_RN32
    1.45 +static av_always_inline uint32_t AV_RN32(const void *p)
    1.46 +{
    1.47 +    uint32_t v;
    1.48 +    __asm__ ("ldr  %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));
    1.49 +    return v;
    1.50 +}
    1.51 +
    1.52 +#define AV_WN32 AV_WN32
    1.53 +static av_always_inline void AV_WN32(void *p, uint32_t v)
    1.54 +{
    1.55 +    __asm__ ("str  %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
    1.56 +}
    1.57 +
    1.58 +#define AV_RN64 AV_RN64
    1.59 +static av_always_inline uint64_t AV_RN64(const void *p)
    1.60 +{
    1.61 +    union { uint64_t v; uint32_t hl[2]; } v;
    1.62 +    __asm__ ("ldr   %0, %2  \n\t"
    1.63 +             "ldr   %1, %3  \n\t"
    1.64 +             : "=&r"(v.hl[0]), "=r"(v.hl[1])
    1.65 +             : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1)));
    1.66 +    return v.v;
    1.67 +}
    1.68 +
    1.69 +#define AV_WN64 AV_WN64
    1.70 +static av_always_inline void AV_WN64(void *p, uint64_t v)
    1.71 +{
    1.72 +    union { uint64_t v; uint32_t hl[2]; } vv = { v };
    1.73 +    __asm__ ("str  %2, %0  \n\t"
    1.74 +             "str  %3, %1  \n\t"
    1.75 +             : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
    1.76 +             : "r"(vv.hl[0]), "r"(vv.hl[1]));
    1.77 +}
    1.78 +
    1.79 +#endif /* HAVE_INLINE_ASM */
    1.80 +
    1.81 +#endif /* AVUTIL_ARM_INTREADWRITE_H */