Checkpoint before working on linkedlist stuff
This commit is contained in:
35
05/llist.h
Normal file
35
05/llist.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user