6#define GET_OBJ_NODE(list, obj) ((Link*)(((u32)(obj)) + (list)->mOffset))
18 if (list->
mpHead ==
nullptr) {
19 Link *node = GET_OBJ_NODE(list, obj);
27 Link *node = GET_OBJ_NODE(list, obj);
32 GET_OBJ_NODE(list, list->
mpTail)->mpNext = obj;
43 if (list->
mpHead ==
nullptr) {
44 Link *node = GET_OBJ_NODE(list, obj);
52 Link *node = GET_OBJ_NODE(list, obj);
57 GET_OBJ_NODE(list, list->
mpHead)->mpPrev = obj;
69 if (target ==
nullptr) {
72 }
else if (target == list->
mpHead) {
76 Link *node = GET_OBJ_NODE(list, obj);
77 void *prevObj = GET_OBJ_NODE(list, target)->mpPrev;
78 Link *prevNode = GET_OBJ_NODE(list, prevObj);
86 GET_OBJ_NODE(list, target)->mpPrev = obj;
94 Link *node = GET_OBJ_NODE(list, obj);
98 if (node->
mpPrev ==
nullptr) {
101 GET_OBJ_NODE(list, node->
mpPrev)->mpNext = node->
mpNext;
106 if (node->
mpNext ==
nullptr) {
109 GET_OBJ_NODE(list, node->
mpNext)->mpPrev = node->
mpPrev;
121 if (obj ==
nullptr) {
125 return GET_OBJ_NODE(list, obj)->mpNext;
129 if (obj ==
nullptr) {
133 return GET_OBJ_NODE(list, obj)->mpPrev;
void List_Append(List *list, void *obj)
Adds an object to the end of the list.
void List_Prepend(List *list, void *obj)
Adds an object to the beginning of the list.
void List_Remove(List *list, void *obj)
Deletes an object from the list.
void * List_GetPrev(const List *list, const void *obj)
Gets the object linked before the given one.
void List_Init(List *list, u16 offset)
Initializes the list.
void * List_GetNext(const List *list, const void *obj)
Gets the object linked after the given one.
void List_Insert(List *list, void *target, void *obj)
Inserts an object at a specified position in the list.
A doubly-linked list node. See List.
void * mpPrev
The previous linked object.
void * mpNext
The next linked object.
A doubly-linked list container. See Link.
void * mpHead
The first linked object.
u16 mCount
The linked object count.
u16 mOffset
The offset of the Link structure in each object.
void * mpTail
The last linked object.