elemy-utils 1.0.0
Data Structures | Macros | Typedefs | Functions
psl_ndx.h File Reference
#include "elutils/c_decls.h"
Include dependency graph for psl_ndx.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _psl_ndx_t
 

Macros

#define PSL_NDX_ELEM_NEXT(ARR_BASE, LINK_FIELD_NAME, NDX)   (ARR_BASE[NDX].LINK_FIELD_NAME.next)
 return index of next elem in list More...
 
#define PSL_NDX_ELEM_PREV(ARR_BASE, LINK_FIELD_NAME, NDX)   (ARR_BASE[NDX].LINK_FIELD_NAME.prev)
 
#define PSL_NDX_ELEM_PREV_PTR(ARR_BASE, LINK_FIELD_NAME, NDX)   (ARR_BASE[NDX].LINK_FIELD_NAME.prev != -1? &(ARR_BASE[ARR_BASE[NDX].LINK_FIELD_NAME.prev]) : NULL)
 
#define PSL_NDX_ELEM_NEXT_PTR(ARR_BASE, LINK_FIELD_NAME, NDX)   (ARR_BASE[NDX].LINK_FIELD_NAME.prev != -1? &(ARR_BASE[ARR_BASE[NDX].LINK_FIELD_NAME.next]) : NULL)
 

Typedefs

typedef __BEGIN_DECLS struct _psl_ndx_t psl_ndx_t
 

Functions

static void psl_ndx_init (psl_ndx_t *ndx)
 
static void psl_ndx_add_head (psl_ndx_t *base, psl_ndx_t *new_node, psl_ndx_t *next_node, int new_ndx)
 
static void psl_ndx_add_tail (psl_ndx_t *base, psl_ndx_t *new_node, psl_ndx_t *prev_node, int new_ndx)
 

Detailed Description

Created on: 26 февр. 2024 г. Author: ps

Macro Definition Documentation

◆ PSL_NDX_ELEM_NEXT

#define PSL_NDX_ELEM_NEXT (   ARR_BASE,
  LINK_FIELD_NAME,
  NDX 
)    (ARR_BASE[NDX].LINK_FIELD_NAME.next)

return index of next elem in list

◆ PSL_NDX_ELEM_NEXT_PTR

#define PSL_NDX_ELEM_NEXT_PTR (   ARR_BASE,
  LINK_FIELD_NAME,
  NDX 
)    (ARR_BASE[NDX].LINK_FIELD_NAME.prev != -1? &(ARR_BASE[ARR_BASE[NDX].LINK_FIELD_NAME.next]) : NULL)

◆ PSL_NDX_ELEM_PREV

#define PSL_NDX_ELEM_PREV (   ARR_BASE,
  LINK_FIELD_NAME,
  NDX 
)    (ARR_BASE[NDX].LINK_FIELD_NAME.prev)

◆ PSL_NDX_ELEM_PREV_PTR

#define PSL_NDX_ELEM_PREV_PTR (   ARR_BASE,
  LINK_FIELD_NAME,
  NDX 
)    (ARR_BASE[NDX].LINK_FIELD_NAME.prev != -1? &(ARR_BASE[ARR_BASE[NDX].LINK_FIELD_NAME.prev]) : NULL)

Typedef Documentation

◆ psl_ndx_t

Working with lists in arrays

prev and next ptr limits to -1 (wrong index). E.g. [0]{-1, 3} - [3]{0, 4} - [4]{3, 7} - [7]{4, -1}

Function Documentation

◆ psl_ndx_add_head()

static void psl_ndx_add_head ( psl_ndx_t base,
psl_ndx_t new_node,
psl_ndx_t next_node,
int  new_ndx 
)
inlinestatic

◆ psl_ndx_add_tail()

static void psl_ndx_add_tail ( psl_ndx_t base,
psl_ndx_t new_node,
psl_ndx_t prev_node,
int  new_ndx 
)
inlinestatic

◆ psl_ndx_init()

static void psl_ndx_init ( psl_ndx_t ndx)
inlinestatic