3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Aligned memory allocator - |
* - Aligned memory allocator - |
5 |
* |
* |
6 |
|
* Copyright(C) 2002 Michael Militzer |
7 |
|
* 2002 Edouard Gomez |
8 |
|
* |
9 |
* 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 |
10 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
11 |
* to use this software module in hardware or software products are |
* to use this software module in hardware or software products are |
29 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
30 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
31 |
* |
* |
32 |
****************************************************************************/ |
* $Id: mem_align.c,v 1.9 2002-09-05 21:32:30 edgomez Exp $ |
|
/***************************************************************************** |
|
|
* |
|
|
* History |
|
|
* |
|
|
* - Thu Jun 13 23:50:07 2002 Added legal header |
|
|
* |
|
|
* $Id: mem_align.c,v 1.7 2002-06-13 22:05:09 edgomez Exp $ |
|
33 |
* |
* |
34 |
****************************************************************************/ |
****************************************************************************/ |
35 |
|
|
|
|
|
36 |
#include <stdlib.h> |
#include <stdlib.h> |
37 |
#include <stdio.h> |
#include <stdio.h> |
38 |
#include "mem_align.h" |
#include "mem_align.h" |
85 |
|
|
86 |
/* Align the tmp pointer */ |
/* Align the tmp pointer */ |
87 |
mem_ptr = |
mem_ptr = |
88 |
(uint8_t *) ((uint32_t) (tmp + alignment - 1) & |
(uint8_t *) ((ptr_t) (tmp + alignment - 1) & |
89 |
(~(uint32_t) (alignment - 1))); |
(~(ptr_t) (alignment - 1))); |
90 |
|
|
91 |
/* |
/* |
92 |
* Special case where malloc have already satisfied the alignment |
* Special case where malloc have already satisfied the alignment |