media/libvpx/vpx_ports/mem.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vpx_ports/mem.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +
    1.15 +#ifndef VPX_PORTS_MEM_H
    1.16 +#define VPX_PORTS_MEM_H
    1.17 +
    1.18 +#include "vpx_config.h"
    1.19 +#include "vpx/vpx_integer.h"
    1.20 +
    1.21 +#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
    1.22 +#define DECLARE_ALIGNED(n,typ,val)  typ val __attribute__ ((aligned (n)))
    1.23 +#elif defined(_MSC_VER)
    1.24 +#define DECLARE_ALIGNED(n,typ,val)  __declspec(align(n)) typ val
    1.25 +#else
    1.26 +#warning No alignment directives known for this compiler.
    1.27 +#define DECLARE_ALIGNED(n,typ,val)  typ val
    1.28 +#endif
    1.29 +#endif
    1.30 +
    1.31 +
    1.32 +/* Declare an aligned array on the stack, for situations where the stack
    1.33 + * pointer may not have the alignment we expect. Creates an array with a
    1.34 + * modified name, then defines val to be a pointer, and aligns that pointer
    1.35 + * within the array.
    1.36 + */
    1.37 +#define DECLARE_ALIGNED_ARRAY(a,typ,val,n)\
    1.38 +  typ val##_[(n)+(a)/sizeof(typ)+1];\
    1.39 +  typ *val = (typ*)((((intptr_t)val##_)+(a)-1)&((intptr_t)-(a)))
    1.40 +
    1.41 +
    1.42 +/* Indicates that the usage of the specified variable has been audited to assure
    1.43 + * that it's safe to use uninitialized. Silences 'may be used uninitialized'
    1.44 + * warnings on gcc.
    1.45 + */
    1.46 +#if defined(__GNUC__) && __GNUC__
    1.47 +#define UNINITIALIZED_IS_SAFE(x) x=x
    1.48 +#else
    1.49 +#define UNINITIALIZED_IS_SAFE(x) x
    1.50 +#endif

mercurial