This commit is contained in:
2026-09-07 18:48:16 +08:00
parent 1564716731
commit c945aa211f
138 changed files with 10337 additions and 150 deletions
+15 -31
View File
@@ -1,48 +1,32 @@
#ifndef INCLUDED_C_ADJLIST_H
#define INCLUDED_C_ADJLIST_H
#ifndef INCLUDED_C_TYPES_H
#include <c_Types.h>
#endif /*INCLUDED_C_TYPES_H*/
#ifndef INCLUDED_C_UINTARRAY_H
#include <c_UIntArray.h>
#endif /*INCLUDED_C_UINTARRAY_H*/
#ifndef INCLUDED_C_ALLOCATOR_H
#include <c_Allocator.h>
#endif /*INCLUDED_C_ALLOCATOR_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
c_uint_t* array;
c_size_t capacity;
c_size_t size;
c_Allocator_t allocator;
}c_AdjList_t;
typedef c_UIntArray_t c_AdjList_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#define c_AdjList_Init c_UIntArray_Init
#define c_AdjList_Destroy c_UIntArray_Destroy
#define c_AdjList_Resize c_UIntArray_Resize
#define c_AdjList_Append c_UIntArray_Append
#define c_AdjList_Set c_UIntArray_Set
#define c_AdjList_Get c_UIntArray_Get
#define c_AdjList_Remove c_UIntArray_Remove
#define c_AdjList_IsEmpty c_UIntArray_IsEmpty
#define c_AdjList_GetSize c_UIntArray_GetSize
#define c_AdjList_Copy c_UIntArray_Copy
c_err_t c_AdjList_Init(c_AdjList_t* self, c_size_t capacity, c_Allocator_t* allocator);
void c_AdjList_Destroy(c_AdjList_t* self);
c_err_t c_AdjList_Resize(c_AdjList_t* self, c_size_t new_capacity);
c_err_t c_AdjList_Append(c_AdjList_t* self, c_uint_t value);
c_err_t c_AdjList_Set(c_AdjList_t* self, c_size_t index, c_uint_t value);
c_err_t c_AdjList_Get(c_AdjList_t* self, c_size_t index, c_uint_t* value);
c_err_t c_AdjList_Remove(c_AdjList_t* self, c_size_t index);
C_STATIC_FORCE_INLINE
c_bool_t c_AdjList_IsEmpty(c_AdjList_t* self) {
if (!self) return C_TRUE;
return self->size==0;
}
#endif /*INCLUDED_C_ADJLIST_H*/