diff options
Diffstat (limited to 'all_pairs/source/audiobeam/audiobeamlibmalloc.c')
| -rw-r--r-- | all_pairs/source/audiobeam/audiobeamlibmalloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/all_pairs/source/audiobeam/audiobeamlibmalloc.c b/all_pairs/source/audiobeam/audiobeamlibmalloc.c new file mode 100644 index 0000000..50c3073 --- /dev/null +++ b/all_pairs/source/audiobeam/audiobeamlibmalloc.c | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #include "audiobeamlibmalloc.h" | ||
| 2 | |||
| 3 | #define AUDIOBEAM_HEAP_SIZE 10000 | ||
| 4 | |||
| 5 | static char audiobeam_simulated_heap[AUDIOBEAM_HEAP_SIZE]; | ||
| 6 | static unsigned int audiobeam_freeHeapPos; | ||
| 7 | |||
| 8 | void *audiobeam_malloc( unsigned int numberOfBytes ) | ||
| 9 | { | ||
| 10 | void *currentPos = ( void * )&audiobeam_simulated_heap[ audiobeam_freeHeapPos ]; | ||
| 11 | /* Get a 4-byte address for alignment purposes */ | ||
| 12 | audiobeam_freeHeapPos += ( ( numberOfBytes + 4 ) & ( unsigned int )0xfffffffc ); | ||
| 13 | return currentPos; | ||
| 14 | } \ No newline at end of file | ||
