I will never be able to sleep before an exam

This commit is contained in:
Brett Weiland 2023-10-27 07:35:48 -05:00
parent e811d778ea
commit 03a3acd11b

View File

@ -24,11 +24,15 @@ static struct pwm_event {
} events[SOFTPWM_PIN_COUNT + 1];
#define LIST_INSERT(new, former, member) (\
list_insert(&(new.member), &(former.member), offsetof(struct pwm_event, time)))
static void list_insert(struct link_pair *new_links, struct link_pair *former_links, size_t parent_offset) {
#define LIST_INSERT(new, prev, member) (\
list_insert(&(new.member), &(prev.member), offsetof(struct pwm_event, member)))
//TODO GYAAAAAAAGH!!!
static void list_insert(struct link_pair *new_links, struct link_pair *prev_links, size_t parent_offset) {
new_links->next = prev_links->next;
new_links->prev = (struct pwm_event *)(char *)prev_links - parent_offset;
((struct link_pair *)(char *)prev_links->next + parent_offset)->prev = (struct pwm_event *)(char *)new_links - parent_offset; //GYAAAAGH
prev_links->next = (struct pwm_event *)(char *)new_links - parent_offset;
}
static void list_remove(struct link_pair *event) {