metaverse-dev/include/libk/lst.h

41 lines
939 B
C
Raw Normal View History

2023-12-13 02:24:25 +08:00
#ifndef LST_H
#define LST_H 1
/*
Line Search Table
线
*/
#include <types.h>
typedef struct __lst_line_t
{
usize left, right;
} lst_line_t;
typedef struct __lst_iterator_t
{
lst_line_t line;
struct __lst_iterator_t *next;
} lst_iterator_t;
lst_iterator_t *lst_new(usize start, usize end);
lst_iterator_t *lst_next(lst_iterator_t *iterator);
/*
`lst`线[left,right)
force=true时忽略不存在于`lst`线
force=false时若有不存在于`lst`线线falsetrue
*/
bool lst_remove(lst_iterator_t *lst, usize left, usize right, bool force);
/*
`lst`线[left,right)
force=true时忽略已经存在于`lst`线
force=false时若有存在于`lst`线线falsetrue
2023-12-13 02:24:25 +08:00
*/
bool lst_add(lst_iterator_t *lst, usize left, usize right, bool force);
#endif