35 lines
843 B
C
35 lines
843 B
C
#ifndef LLIST_H
|
|
#define LLIST_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define ADVENT_MAP_PRINT(X) do {printf("Dest: %d Src: %d Len: %d\n", X.dest, X.src, X.len);} while (0);
|
|
|
|
#define ADVENT_MAP_EQ(X,Y) (X.dest == Y.dest && X.src == Y.src && X.len == Y.len)
|
|
|
|
typedef struct advent_map {
|
|
uint64_t dest;
|
|
uint64_t src;
|
|
uint64_t len;
|
|
} advent_map;
|
|
|
|
// Node structure
|
|
typedef struct advent_node {
|
|
advent_map map;
|
|
struct advent_node *next;
|
|
} advent_node;
|
|
|
|
// Linked list structure
|
|
typedef struct linked_list {
|
|
advent_node* head;
|
|
} linked_list;
|
|
|
|
void ll_init(linked_list* list);
|
|
void ll_prepend(linked_list* list, advent_map map);
|
|
void ll_append(linked_list* list, advent_map map);
|
|
void ll_remove(linked_list* list, advent_map map);
|
|
void ll_print(linked_list* list);
|
|
void ll_free(linked_list* list);
|
|
|
|
|
|
#endif |