aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ll.h
blob: 4a11620fa83ce170e4ac0375433deb9cdcfc8f07 (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
#ifndef LIB_LL_H
#define LIB_LL_H

struct LL {
	struct LL* prev;
	struct LL* next;
	void* data;
};

struct LL* new(void* val);
void push(struct LL* l, void* val);
void remove(struct LL* l, unsigned long idx);

#define showl(L, TYPE) { \
	struct LL* t = L; \
	do { \
		uart_hex(*(TYPE*)t->data); \
		t = t->next; \
		if (t != l) \
			uart_char(' '); \
	} while (t != l); \
}

#endif