diff libavutil/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/intreadwrite.h	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,498 @@
     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_INTREADWRITE_H
    1.23 +#define AVUTIL_INTREADWRITE_H
    1.24 +
    1.25 +#include <stdint.h>
    1.26 +#include "config.h"
    1.27 +#include "bswap.h"
    1.28 +#include "common.h"
    1.29 +
    1.30 +typedef union {
    1.31 +    uint64_t u64;
    1.32 +    uint32_t u32[2];
    1.33 +    uint16_t u16[4];
    1.34 +    uint8_t  u8 [8];
    1.35 +    double   f64;
    1.36 +    float    f32[2];
    1.37 +} __attribute__((__may_alias__)) av_alias64;
    1.38 +
    1.39 +typedef union {
    1.40 +    uint32_t u32;
    1.41 +    uint16_t u16[2];
    1.42 +    uint8_t  u8 [4];
    1.43 +    float    f32;
    1.44 +} __attribute__((__may_alias__)) av_alias32;
    1.45 +
    1.46 +typedef union {
    1.47 +    uint16_t u16;
    1.48 +    uint8_t  u8 [2];
    1.49 +} __attribute__((__may_alias__)) av_alias16  ;
    1.50 +
    1.51 +/*
    1.52 + * Arch-specific headers can provide any combination of
    1.53 + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
    1.54 + * Preprocessor symbols must be defined, even if these are implemented
    1.55 + * as inline functions.
    1.56 + */
    1.57 +
    1.58 +#if   ARCH_ARM
    1.59 +#   include "arm/intreadwrite.h"
    1.60 +#elif ARCH_PPC
    1.61 +#   include "ppc/intreadwrite.h"
    1.62 +#elif ARCH_X86
    1.63 +#   include "x86/intreadwrite.h"
    1.64 +#endif
    1.65 +
    1.66 +/*
    1.67 + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
    1.68 + */
    1.69 +
    1.70 +#if HAVE_BIGENDIAN
    1.71 +
    1.72 +#   if    defined(AV_RN16) && !defined(AV_RB16)
    1.73 +#       define AV_RB16(p) AV_RN16(p)
    1.74 +#   elif !defined(AV_RN16) &&  defined(AV_RB16)
    1.75 +#       define AV_RN16(p) AV_RB16(p)
    1.76 +#   endif
    1.77 +
    1.78 +#   if    defined(AV_WN16) && !defined(AV_WB16)
    1.79 +#       define AV_WB16(p, v) AV_WN16(p, v)
    1.80 +#   elif !defined(AV_WN16) &&  defined(AV_WB16)
    1.81 +#       define AV_WN16(p, v) AV_WB16(p, v)
    1.82 +#   endif
    1.83 +
    1.84 +#   if    defined(AV_RN24) && !defined(AV_RB24)
    1.85 +#       define AV_RB24(p) AV_RN24(p)
    1.86 +#   elif !defined(AV_RN24) &&  defined(AV_RB24)
    1.87 +#       define AV_RN24(p) AV_RB24(p)
    1.88 +#   endif
    1.89 +
    1.90 +#   if    defined(AV_WN24) && !defined(AV_WB24)
    1.91 +#       define AV_WB24(p, v) AV_WN24(p, v)
    1.92 +#   elif !defined(AV_WN24) &&  defined(AV_WB24)
    1.93 +#       define AV_WN24(p, v) AV_WB24(p, v)
    1.94 +#   endif
    1.95 +
    1.96 +#   if    defined(AV_RN32) && !defined(AV_RB32)
    1.97 +#       define AV_RB32(p) AV_RN32(p)
    1.98 +#   elif !defined(AV_RN32) &&  defined(AV_RB32)
    1.99 +#       define AV_RN32(p) AV_RB32(p)
   1.100 +#   endif
   1.101 +
   1.102 +#   if    defined(AV_WN32) && !defined(AV_WB32)
   1.103 +#       define AV_WB32(p, v) AV_WN32(p, v)
   1.104 +#   elif !defined(AV_WN32) &&  defined(AV_WB32)
   1.105 +#       define AV_WN32(p, v) AV_WB32(p, v)
   1.106 +#   endif
   1.107 +
   1.108 +#   if    defined(AV_RN64) && !defined(AV_RB64)
   1.109 +#       define AV_RB64(p) AV_RN64(p)
   1.110 +#   elif !defined(AV_RN64) &&  defined(AV_RB64)
   1.111 +#       define AV_RN64(p) AV_RB64(p)
   1.112 +#   endif
   1.113 +
   1.114 +#   if    defined(AV_WN64) && !defined(AV_WB64)
   1.115 +#       define AV_WB64(p, v) AV_WN64(p, v)
   1.116 +#   elif !defined(AV_WN64) &&  defined(AV_WB64)
   1.117 +#       define AV_WN64(p, v) AV_WB64(p, v)
   1.118 +#   endif
   1.119 +
   1.120 +#else /* HAVE_BIGENDIAN */
   1.121 +
   1.122 +#   if    defined(AV_RN16) && !defined(AV_RL16)
   1.123 +#       define AV_RL16(p) AV_RN16(p)
   1.124 +#   elif !defined(AV_RN16) &&  defined(AV_RL16)
   1.125 +#       define AV_RN16(p) AV_RL16(p)
   1.126 +#   endif
   1.127 +
   1.128 +#   if    defined(AV_WN16) && !defined(AV_WL16)
   1.129 +#       define AV_WL16(p, v) AV_WN16(p, v)
   1.130 +#   elif !defined(AV_WN16) &&  defined(AV_WL16)
   1.131 +#       define AV_WN16(p, v) AV_WL16(p, v)
   1.132 +#   endif
   1.133 +
   1.134 +#   if    defined(AV_RN24) && !defined(AV_RL24)
   1.135 +#       define AV_RL24(p) AV_RN24(p)
   1.136 +#   elif !defined(AV_RN24) &&  defined(AV_RL24)
   1.137 +#       define AV_RN24(p) AV_RL24(p)
   1.138 +#   endif
   1.139 +
   1.140 +#   if    defined(AV_WN24) && !defined(AV_WL24)
   1.141 +#       define AV_WL24(p, v) AV_WN24(p, v)
   1.142 +#   elif !defined(AV_WN24) &&  defined(AV_WL24)
   1.143 +#       define AV_WN24(p, v) AV_WL24(p, v)
   1.144 +#   endif
   1.145 +
   1.146 +#   if    defined(AV_RN32) && !defined(AV_RL32)
   1.147 +#       define AV_RL32(p) AV_RN32(p)
   1.148 +#   elif !defined(AV_RN32) &&  defined(AV_RL32)
   1.149 +#       define AV_RN32(p) AV_RL32(p)
   1.150 +#   endif
   1.151 +
   1.152 +#   if    defined(AV_WN32) && !defined(AV_WL32)
   1.153 +#       define AV_WL32(p, v) AV_WN32(p, v)
   1.154 +#   elif !defined(AV_WN32) &&  defined(AV_WL32)
   1.155 +#       define AV_WN32(p, v) AV_WL32(p, v)
   1.156 +#   endif
   1.157 +
   1.158 +#   if    defined(AV_RN64) && !defined(AV_RL64)
   1.159 +#       define AV_RL64(p) AV_RN64(p)
   1.160 +#   elif !defined(AV_RN64) &&  defined(AV_RL64)
   1.161 +#       define AV_RN64(p) AV_RL64(p)
   1.162 +#   endif
   1.163 +
   1.164 +#   if    defined(AV_WN64) && !defined(AV_WL64)
   1.165 +#       define AV_WL64(p, v) AV_WN64(p, v)
   1.166 +#   elif !defined(AV_WN64) &&  defined(AV_WL64)
   1.167 +#       define AV_WN64(p, v) AV_WL64(p, v)
   1.168 +#   endif
   1.169 +
   1.170 +#endif /* !HAVE_BIGENDIAN */
   1.171 +
   1.172 +/*
   1.173 + * Define AV_[RW]N helper macros to simplify definitions not provided
   1.174 + * by per-arch headers.
   1.175 + */
   1.176 +
   1.177 +
   1.178 +
   1.179 +#if defined(__DECC)
   1.180 +
   1.181 +#   define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
   1.182 +#   define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
   1.183 +
   1.184 +#else
   1.185 +
   1.186 +#ifndef AV_RB16
   1.187 +#   define AV_RB16(x)                           \
   1.188 +    ((((const uint8_t*)(x))[0] << 8) |          \
   1.189 +      ((const uint8_t*)(x))[1])
   1.190 +#endif
   1.191 +#ifndef AV_WB16
   1.192 +#   define AV_WB16(p, d) do {                   \
   1.193 +        ((uint8_t*)(p))[1] = (d);               \
   1.194 +        ((uint8_t*)(p))[0] = (d)>>8;            \
   1.195 +    } while(0)
   1.196 +#endif
   1.197 +
   1.198 +#ifndef AV_RL16
   1.199 +#   define AV_RL16(x)                           \
   1.200 +    ((((const uint8_t*)(x))[1] << 8) |          \
   1.201 +      ((const uint8_t*)(x))[0])
   1.202 +#endif
   1.203 +#ifndef AV_WL16
   1.204 +#   define AV_WL16(p, d) do {                   \
   1.205 +        ((uint8_t*)(p))[0] = (d);               \
   1.206 +        ((uint8_t*)(p))[1] = (d)>>8;            \
   1.207 +    } while(0)
   1.208 +#endif
   1.209 +
   1.210 +#ifndef AV_RB32
   1.211 +#   define AV_RB32(x)                           \
   1.212 +    ((((const uint8_t*)(x))[0] << 24) |         \
   1.213 +     (((const uint8_t*)(x))[1] << 16) |         \
   1.214 +     (((const uint8_t*)(x))[2] <<  8) |         \
   1.215 +      ((const uint8_t*)(x))[3])
   1.216 +#endif
   1.217 +#ifndef AV_WB32
   1.218 +#   define AV_WB32(p, d) do {                   \
   1.219 +        ((uint8_t*)(p))[3] = (d);               \
   1.220 +        ((uint8_t*)(p))[2] = (d)>>8;            \
   1.221 +        ((uint8_t*)(p))[1] = (d)>>16;           \
   1.222 +        ((uint8_t*)(p))[0] = (d)>>24;           \
   1.223 +    } while(0)
   1.224 +#endif
   1.225 +
   1.226 +#ifndef AV_RL32
   1.227 +#   define AV_RL32(x)                           \
   1.228 +    ((((const uint8_t*)(x))[3] << 24) |         \
   1.229 +     (((const uint8_t*)(x))[2] << 16) |         \
   1.230 +     (((const uint8_t*)(x))[1] <<  8) |         \
   1.231 +      ((const uint8_t*)(x))[0])
   1.232 +#endif
   1.233 +#ifndef AV_WL32
   1.234 +#   define AV_WL32(p, d) do {                   \
   1.235 +        ((uint8_t*)(p))[0] = (d);               \
   1.236 +        ((uint8_t*)(p))[1] = (d)>>8;            \
   1.237 +        ((uint8_t*)(p))[2] = (d)>>16;           \
   1.238 +        ((uint8_t*)(p))[3] = (d)>>24;           \
   1.239 +    } while(0)
   1.240 +#endif
   1.241 +
   1.242 +#ifndef AV_RB64
   1.243 +#   define AV_RB64(x)                                   \
   1.244 +    (((uint64_t)((const uint8_t*)(x))[0] << 56) |       \
   1.245 +     ((uint64_t)((const uint8_t*)(x))[1] << 48) |       \
   1.246 +     ((uint64_t)((const uint8_t*)(x))[2] << 40) |       \
   1.247 +     ((uint64_t)((const uint8_t*)(x))[3] << 32) |       \
   1.248 +     ((uint64_t)((const uint8_t*)(x))[4] << 24) |       \
   1.249 +     ((uint64_t)((const uint8_t*)(x))[5] << 16) |       \
   1.250 +     ((uint64_t)((const uint8_t*)(x))[6] <<  8) |       \
   1.251 +      (uint64_t)((const uint8_t*)(x))[7])
   1.252 +#endif
   1.253 +#ifndef AV_WB64
   1.254 +#   define AV_WB64(p, d) do {                   \
   1.255 +        ((uint8_t*)(p))[7] = (d);               \
   1.256 +        ((uint8_t*)(p))[6] = (d)>>8;            \
   1.257 +        ((uint8_t*)(p))[5] = (d)>>16;           \
   1.258 +        ((uint8_t*)(p))[4] = (d)>>24;           \
   1.259 +        ((uint8_t*)(p))[3] = (d)>>32;           \
   1.260 +        ((uint8_t*)(p))[2] = (d)>>40;           \
   1.261 +        ((uint8_t*)(p))[1] = (d)>>48;           \
   1.262 +        ((uint8_t*)(p))[0] = (d)>>56;           \
   1.263 +    } while(0)
   1.264 +#endif
   1.265 +
   1.266 +#ifndef AV_RL64
   1.267 +#   define AV_RL64(x)                                   \
   1.268 +    (((uint64_t)((const uint8_t*)(x))[7] << 56) |       \
   1.269 +     ((uint64_t)((const uint8_t*)(x))[6] << 48) |       \
   1.270 +     ((uint64_t)((const uint8_t*)(x))[5] << 40) |       \
   1.271 +     ((uint64_t)((const uint8_t*)(x))[4] << 32) |       \
   1.272 +     ((uint64_t)((const uint8_t*)(x))[3] << 24) |       \
   1.273 +     ((uint64_t)((const uint8_t*)(x))[2] << 16) |       \
   1.274 +     ((uint64_t)((const uint8_t*)(x))[1] <<  8) |       \
   1.275 +      (uint64_t)((const uint8_t*)(x))[0])
   1.276 +#endif
   1.277 +#ifndef AV_WL64
   1.278 +#   define AV_WL64(p, d) do {                   \
   1.279 +        ((uint8_t*)(p))[0] = (d);               \
   1.280 +        ((uint8_t*)(p))[1] = (d)>>8;            \
   1.281 +        ((uint8_t*)(p))[2] = (d)>>16;           \
   1.282 +        ((uint8_t*)(p))[3] = (d)>>24;           \
   1.283 +        ((uint8_t*)(p))[4] = (d)>>32;           \
   1.284 +        ((uint8_t*)(p))[5] = (d)>>40;           \
   1.285 +        ((uint8_t*)(p))[6] = (d)>>48;           \
   1.286 +        ((uint8_t*)(p))[7] = (d)>>56;           \
   1.287 +    } while(0)
   1.288 +#endif
   1.289 +
   1.290 +#if HAVE_BIGENDIAN
   1.291 +#   define AV_RN(s, p)    AV_RB##s(p)
   1.292 +#   define AV_WN(s, p, v) AV_WB##s(p, v)
   1.293 +#else
   1.294 +#   define AV_RN(s, p)    AV_RL##s(p)
   1.295 +#   define AV_WN(s, p, v) AV_WL##s(p, v)
   1.296 +#endif
   1.297 +
   1.298 +#endif /* HAVE_FAST_UNALIGNED */
   1.299 +
   1.300 +#ifndef AV_RN16
   1.301 +#   define AV_RN16(p) AV_RN(16, p)
   1.302 +#endif
   1.303 +
   1.304 +#ifndef AV_RN32
   1.305 +#   define AV_RN32(p) AV_RN(32, p)
   1.306 +#endif
   1.307 +
   1.308 +#ifndef AV_RN64
   1.309 +#   define AV_RN64(p) AV_RN(64, p)
   1.310 +#endif
   1.311 +
   1.312 +#ifndef AV_WN16
   1.313 +#   define AV_WN16(p, v) AV_WN(16, p, v)
   1.314 +#endif
   1.315 +
   1.316 +#ifndef AV_WN32
   1.317 +#   define AV_WN32(p, v) AV_WN(32, p, v)
   1.318 +#endif
   1.319 +
   1.320 +#ifndef AV_WN64
   1.321 +#   define AV_WN64(p, v) AV_WN(64, p, v)
   1.322 +#endif
   1.323 +
   1.324 +#if HAVE_BIGENDIAN
   1.325 +#   define AV_RB(s, p)    AV_RN##s(p)
   1.326 +#   define AV_WB(s, p, v) AV_WN##s(p, v)
   1.327 +#   define AV_RL(s, p)    bswap_##s(AV_RN##s(p))
   1.328 +#   define AV_WL(s, p, v) AV_WN##s(p, bswap_##s(v))
   1.329 +#else
   1.330 +#   define AV_RB(s, p)    bswap_##s(AV_RN##s(p))
   1.331 +#   define AV_WB(s, p, v) AV_WN##s(p, bswap_##s(v))
   1.332 +#   define AV_RL(s, p)    AV_RN##s(p)
   1.333 +#   define AV_WL(s, p, v) AV_WN##s(p, v)
   1.334 +#endif
   1.335 +
   1.336 +#define AV_RB8(x)     (((const uint8_t*)(x))[0])
   1.337 +#define AV_WB8(p, d)  do { ((uint8_t*)(p))[0] = (d); } while(0)
   1.338 +
   1.339 +#define AV_RL8(x)     AV_RB8(x)
   1.340 +#define AV_WL8(p, d)  AV_WB8(p, d)
   1.341 +
   1.342 +#ifndef AV_RB16
   1.343 +#   define AV_RB16(p)    AV_RB(16, p)
   1.344 +#endif
   1.345 +#ifndef AV_WB16
   1.346 +#   define AV_WB16(p, v) AV_WB(16, p, v)
   1.347 +#endif
   1.348 +
   1.349 +#ifndef AV_RL16
   1.350 +#   define AV_RL16(p)    AV_RL(16, p)
   1.351 +#endif
   1.352 +#ifndef AV_WL16
   1.353 +#   define AV_WL16(p, v) AV_WL(16, p, v)
   1.354 +#endif
   1.355 +
   1.356 +#ifndef AV_RB32
   1.357 +#   define AV_RB32(p)    AV_RB(32, p)
   1.358 +#endif
   1.359 +#ifndef AV_WB32
   1.360 +#   define AV_WB32(p, v) AV_WB(32, p, v)
   1.361 +#endif
   1.362 +
   1.363 +#ifndef AV_RL32
   1.364 +#   define AV_RL32(p)    AV_RL(32, p)
   1.365 +#endif
   1.366 +#ifndef AV_WL32
   1.367 +#   define AV_WL32(p, v) AV_WL(32, p, v)
   1.368 +#endif
   1.369 +
   1.370 +#ifndef AV_RB64
   1.371 +#   define AV_RB64(p)    AV_RB(64, p)
   1.372 +#endif
   1.373 +#ifndef AV_WB64
   1.374 +#   define AV_WB64(p, v) AV_WB(64, p, v)
   1.375 +#endif
   1.376 +
   1.377 +#ifndef AV_RL64
   1.378 +#   define AV_RL64(p)    AV_RL(64, p)
   1.379 +#endif
   1.380 +#ifndef AV_WL64
   1.381 +#   define AV_WL64(p, v) AV_WL(64, p, v)
   1.382 +#endif
   1.383 +
   1.384 +#ifndef AV_RB24
   1.385 +#   define AV_RB24(x)                           \
   1.386 +    ((((const uint8_t*)(x))[0] << 16) |         \
   1.387 +     (((const uint8_t*)(x))[1] <<  8) |         \
   1.388 +      ((const uint8_t*)(x))[2])
   1.389 +#endif
   1.390 +#ifndef AV_WB24
   1.391 +#   define AV_WB24(p, d) do {                   \
   1.392 +        ((uint8_t*)(p))[2] = (d);               \
   1.393 +        ((uint8_t*)(p))[1] = (d)>>8;            \
   1.394 +        ((uint8_t*)(p))[0] = (d)>>16;           \
   1.395 +    } while(0)
   1.396 +#endif
   1.397 +
   1.398 +#ifndef AV_RL24
   1.399 +#   define AV_RL24(x)                           \
   1.400 +    ((((const uint8_t*)(x))[2] << 16) |         \
   1.401 +     (((const uint8_t*)(x))[1] <<  8) |         \
   1.402 +      ((const uint8_t*)(x))[0])
   1.403 +#endif
   1.404 +#ifndef AV_WL24
   1.405 +#   define AV_WL24(p, d) do {                   \
   1.406 +        ((uint8_t*)(p))[0] = (d);               \
   1.407 +        ((uint8_t*)(p))[1] = (d)>>8;            \
   1.408 +        ((uint8_t*)(p))[2] = (d)>>16;           \
   1.409 +    } while(0)
   1.410 +#endif
   1.411 +
   1.412 +/*
   1.413 + * The AV_[RW]NA macros access naturally aligned data
   1.414 + * in a type-safe way.
   1.415 + */
   1.416 +
   1.417 +#define AV_RNA(s, p)    (((const av_alias##s*)(p))->u##s)
   1.418 +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v))
   1.419 +
   1.420 +#ifndef AV_RN16A
   1.421 +#   define AV_RN16A(p) AV_RNA(16, p)
   1.422 +#endif
   1.423 +
   1.424 +#ifndef AV_RN32A
   1.425 +#   define AV_RN32A(p) AV_RNA(32, p)
   1.426 +#endif
   1.427 +
   1.428 +#ifndef AV_RN64A
   1.429 +#   define AV_RN64A(p) AV_RNA(64, p)
   1.430 +#endif
   1.431 +
   1.432 +#ifndef AV_WN16A
   1.433 +#   define AV_WN16A(p, v) AV_WNA(16, p, v)
   1.434 +#endif
   1.435 +
   1.436 +#ifndef AV_WN32A
   1.437 +#   define AV_WN32A(p, v) AV_WNA(32, p, v)
   1.438 +#endif
   1.439 +
   1.440 +#ifndef AV_WN64A
   1.441 +#   define AV_WN64A(p, v) AV_WNA(64, p, v)
   1.442 +#endif
   1.443 +
   1.444 +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
   1.445 + * naturally aligned. They may be implemented using MMX,
   1.446 + * so emms_c() must be called before using any float code
   1.447 + * afterwards.
   1.448 + */
   1.449 +
   1.450 +#define AV_COPY(n, d, s) \
   1.451 +    (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n)
   1.452 +
   1.453 +#ifndef AV_COPY16
   1.454 +#   define AV_COPY16(d, s) AV_COPY(16, d, s)
   1.455 +#endif
   1.456 +
   1.457 +#ifndef AV_COPY32
   1.458 +#   define AV_COPY32(d, s) AV_COPY(32, d, s)
   1.459 +#endif
   1.460 +
   1.461 +#ifndef AV_COPY64
   1.462 +#   define AV_COPY64(d, s) AV_COPY(64, d, s)
   1.463 +#endif
   1.464 +
   1.465 +#ifndef AV_COPY128
   1.466 +#   define AV_COPY128(d, s)                    \
   1.467 +    do {                                       \
   1.468 +        AV_COPY64(d, s);                       \
   1.469 +        AV_COPY64((char*)(d)+8, (char*)(s)+8); \
   1.470 +    } while(0)
   1.471 +#endif
   1.472 +
   1.473 +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b))
   1.474 +
   1.475 +#ifndef AV_SWAP64
   1.476 +#   define AV_SWAP64(a, b) AV_SWAP(64, a, b)
   1.477 +#endif
   1.478 +
   1.479 +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0)
   1.480 +
   1.481 +#ifndef AV_ZERO16
   1.482 +#   define AV_ZERO16(d) AV_ZERO(16, d)
   1.483 +#endif
   1.484 +
   1.485 +#ifndef AV_ZERO32
   1.486 +#   define AV_ZERO32(d) AV_ZERO(32, d)
   1.487 +#endif
   1.488 +
   1.489 +#ifndef AV_ZERO64
   1.490 +#   define AV_ZERO64(d) AV_ZERO(64, d)
   1.491 +#endif
   1.492 +
   1.493 +#ifndef AV_ZERO128
   1.494 +#   define AV_ZERO128(d)         \
   1.495 +    do {                         \
   1.496 +        AV_ZERO64(d);            \
   1.497 +        AV_ZERO64((char*)(d)+8); \
   1.498 +    } while(0)
   1.499 +#endif
   1.500 +
   1.501 +#endif /* AVUTIL_INTREADWRITE_H */