webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Macros | Variables
stack_alloc.h File Reference

Temporary memory allocation on stack. More...

#include "opus_types.h"
#include "opus_defines.h"
#include "os_support.h"

Go to the source code of this file.

Macros

#define ALIGN(stack, size)   ((stack) += ((size) - (long)(stack)) & ((size) - 1))
 
#define PUSH(stack, size, type)   (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
 
#define RESTORE_STACK   (global_stack = _saved_stack)
 
#define ALLOC_STACK   char *_saved_stack; (global_stack = (global_stack==0) ? (scratch_ptr=opus_alloc_scratch(GLOBAL_STACK_SIZE)) : global_stack); _saved_stack = global_stack;
 
#define VARDECL(type, var)   type *var
 
#define ALLOC(var, size, type)   var = PUSH(global_stack, size, type)
 
#define SAVE_STACK   char *_saved_stack = global_stack;
 
#define ALLOC_NONE   0
 
#define OPUS_CHECK_ARRAY(ptr, len)   _opus_false()
 
#define OPUS_CHECK_VALUE(value)   _opus_false()
 
#define OPUS_PRINT_INT(value)   do{}while(0)
 
#define OPUS_FPRINTF   (void)
 

Variables

char * global_stack
 
char * scratch_ptr
 

Detailed Description

Temporary memory allocation on stack.

Macro Definition Documentation

◆ ALIGN

#define ALIGN (   stack,
  size 
)    ((stack) += ((size) - (long)(stack)) & ((size) - 1))

Aligns the stack to a 'size' boundary

Parameters
stackStack
sizeNew size boundary

◆ ALLOC

#define ALLOC (   var,
  size,
  type 
)    var = PUSH(global_stack, size, type)

Allocate 'size' elements of 'type' on stack

Parameters
varName of variable to allocate
sizeNumber of elements
typeType of element

◆ ALLOC_NONE

#define ALLOC_NONE   0

◆ ALLOC_STACK

#define ALLOC_STACK   char *_saved_stack; (global_stack = (global_stack==0) ? (scratch_ptr=opus_alloc_scratch(GLOBAL_STACK_SIZE)) : global_stack); _saved_stack = global_stack;

◆ OPUS_CHECK_ARRAY

#define OPUS_CHECK_ARRAY (   ptr,
  len 
)    _opus_false()

◆ OPUS_CHECK_VALUE

#define OPUS_CHECK_VALUE (   value)    _opus_false()

◆ OPUS_FPRINTF

#define OPUS_FPRINTF   (void)

◆ OPUS_PRINT_INT

#define OPUS_PRINT_INT (   value)    do{}while(0)

◆ PUSH

#define PUSH (   stack,
  size,
  type 
)    (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))

Allocates 'size' elements of type 'type' on the stack

Parameters
stackStack
sizeNumber of elements
typeType of element

◆ RESTORE_STACK

#define RESTORE_STACK   (global_stack = _saved_stack)

◆ SAVE_STACK

#define SAVE_STACK   char *_saved_stack = global_stack;

◆ VARDECL

#define VARDECL (   type,
  var 
)    type *var

Declare variable on stack

Parameters
varVariable to declare

Variable Documentation

◆ global_stack

char* global_stack

◆ scratch_ptr

char* scratch_ptr