FFmpeg
Macros
Alignment Macros

Helper macros for declaring aligned variables. More...

Macros

#define DECLARE_ALIGNED(n, t, v)   t __attribute__ ((aligned (n))) v
 
#define DECLARE_ASM_ALIGNED(n, t, v)   t av_used __attribute__ ((aligned (n))) v
 
#define DECLARE_ASM_CONST(n, t, v)   static const t av_used __attribute__ ((aligned (n))) v
 

Detailed Description

Helper macros for declaring aligned variables.

Macro Definition Documentation

◆ DECLARE_ALIGNED

#define DECLARE_ALIGNED (   n,
  t,
 
)    t __attribute__ ((aligned (n))) v

Declare a variable that is aligned in memory.

DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
// The default-alignment equivalent would be
uint16_t aligned_int = 42;
uint8_t aligned_array[128];
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 117 of file mem.h.

◆ DECLARE_ASM_ALIGNED

#define DECLARE_ASM_ALIGNED (   n,
  t,
 
)    t av_used __attribute__ ((aligned (n))) v

Declare an aligned variable appropriate for use in inline assembly code.

DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 118 of file mem.h.

◆ DECLARE_ASM_CONST

#define DECLARE_ASM_CONST (   n,
  t,
 
)    static const t av_used __attribute__ ((aligned (n))) v

Declare a static constant aligned variable appropriate for use in inline assembly code.

DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
Parameters
nMinimum alignment in bytes
tType of the variable (or array element)
vName of the variable

Definition at line 119 of file mem.h.

DECLARE_ASM_CONST
#define DECLARE_ASM_CONST(n, t, v)
Definition: mem.h:119
DECLARE_ASM_ALIGNED
#define DECLARE_ASM_ALIGNED(n, t, v)
Definition: mem.h:118
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:117