Go to the documentation of this file.
21 #ifndef AVUTIL_MEM_INTERNAL_H
22 #define AVUTIL_MEM_INTERNAL_H
76 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
77 #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (n))) v
78 #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
79 #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
80 #elif defined(__DJGPP__)
81 #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
82 #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
83 #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
84 #elif defined(__GNUC__) || defined(__clang__)
85 #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (n))) v
86 #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
87 #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
88 #elif defined(_MSC_VER)
89 #define DECLARE_ALIGNED_T(n,t,v) __declspec(align(n)) t v
90 #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
91 #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
93 #define DECLARE_ALIGNED_T(n,t,v) t v
94 #define DECLARE_ASM_ALIGNED(n,t,v) t v
95 #define DECLARE_ASM_CONST(n,t,v) static const t v
98 #if HAVE_SIMD_ALIGN_64
101 #elif HAVE_SIMD_ALIGN_32
109 #define DECLARE_ALIGNED(n,t,v) DECLARE_ALIGNED_V(n,t,v)
113 #define DECLARE_ALIGNED_V(n,t,v) DECLARE_ALIGNED_##n(t,v)
115 #define DECLARE_ALIGNED_4(t,v) DECLARE_ALIGNED_T( 4, t, v)
116 #define DECLARE_ALIGNED_8(t,v) DECLARE_ALIGNED_T( 8, t, v)
117 #define DECLARE_ALIGNED_16(t,v) DECLARE_ALIGNED_T( 16, t, v)
118 #define DECLARE_ALIGNED_32(t,v) DECLARE_ALIGNED_T(ALIGN_32, t, v)
119 #define DECLARE_ALIGNED_64(t,v) DECLARE_ALIGNED_T(ALIGN_64, t, v)
125 #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
126 uint8_t la_##v[sizeof(t s o) + (a)]; \
127 t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
129 #define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
130 DECLARE_ALIGNED(a, t, la_##v) s o; \
133 #define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
135 #if HAVE_LOCAL_ALIGNED
136 # define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
138 # define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_A(4, t, v, __VA_ARGS__,,))
141 #if HAVE_LOCAL_ALIGNED
142 # define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
144 # define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
147 #if HAVE_LOCAL_ALIGNED
148 # define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
150 # define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
153 #if HAVE_LOCAL_ALIGNED
154 # define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
156 # define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))