3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Aligned memory allocator - |
* - Aligned memory allocator - |
5 |
* |
* |
|
* Copyright(C) 2002 Michael Militzer |
|
|
* 2002 Edouard Gomez |
|
|
* |
|
6 |
* This program is an implementation of a part of one or more MPEG-4 |
* This program is an implementation of a part of one or more MPEG-4 |
7 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
8 |
* to use this software module in hardware or software products are |
* to use this software module in hardware or software products are |
26 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: mem_align.c,v 1.9 2002-09-05 21:32:30 edgomez Exp $ |
****************************************************************************/ |
30 |
|
/***************************************************************************** |
31 |
|
* |
32 |
|
* History |
33 |
|
* |
34 |
|
* - Thu Jun 13 23:50:07 2002 Added legal header |
35 |
|
* |
36 |
|
* $Id: mem_align.c,v 1.15 2003-02-15 15:22:19 edgomez Exp $ |
37 |
* |
* |
38 |
****************************************************************************/ |
****************************************************************************/ |
39 |
|
|
40 |
|
|
41 |
#include <stdlib.h> |
#include <stdlib.h> |
42 |
#include <stdio.h> |
#include <stdio.h> |
43 |
#include "mem_align.h" |
#include "mem_align.h" |
71 |
if ((mem_ptr = (uint8_t *) malloc(size + 1)) != NULL) { |
if ((mem_ptr = (uint8_t *) malloc(size + 1)) != NULL) { |
72 |
|
|
73 |
/* Store (mem_ptr - "real allocated memory") in *(mem_ptr-1) */ |
/* Store (mem_ptr - "real allocated memory") in *(mem_ptr-1) */ |
74 |
*mem_ptr = 0; |
*mem_ptr = 1; |
75 |
|
|
76 |
/* Return the mem_ptr pointer */ |
/* Return the mem_ptr pointer */ |
77 |
return (void *) mem_ptr++; |
return (void *) mem_ptr++; |