aboutsummaryrefslogtreecommitdiffstats
path: root/misc.h
blob: 7dc738762bc68e99eda44f2c0a50e8694843743f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * misc.h
 * decleration of various helper and misc functions
 *
 * Erik Liodden
 */

#ifndef MISC_H
#define MISC_H

/*
 * allocate `size` bytes and return a pointer to the allocated memory. if the
 * memory can't be allocated, the function will terminate the program.
 */
void *allocate(size_t size);

/*
 * swap two pointers
 */
void swap(void *vp1, void *vp2, size_t elem_size);

/*
 * rotate the first segment between `start` and `middle` after the remaining
 * part of the array
 */
void rotate(void *start, void *middle, void *end);

#endif  /* MISC_H */