remove memcpy from lv_ll
This commit is contained in:
@@ -295,14 +295,13 @@ void * _lv_ll_get_tail(const lv_ll_t * ll_p)
|
|||||||
*/
|
*/
|
||||||
void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
||||||
{
|
{
|
||||||
void * next = NULL;
|
if(ll_p == NULL) return NULL;
|
||||||
|
|
||||||
if(ll_p != NULL) {
|
/* Pointer to the next node is stored in the end of this node.
|
||||||
const lv_ll_node_t * n_act_d = n_act;
|
* Go there and return the address found there */
|
||||||
_lv_memcpy_small(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
|
const lv_ll_node_t * n_act_d = n_act;
|
||||||
}
|
n_act_d += LL_NEXT_P_OFFSET(ll_p);
|
||||||
|
return *((lv_ll_node_t **)n_act_d);
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,14 +312,13 @@ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
|||||||
*/
|
*/
|
||||||
void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
||||||
{
|
{
|
||||||
void * prev = NULL;
|
if(ll_p == NULL) return NULL;
|
||||||
|
|
||||||
if(ll_p != NULL) {
|
/* Pointer to the prev. node is stored in the end of this node.
|
||||||
const lv_ll_node_t * n_act_d = n_act;
|
* Go there and return the address found there */
|
||||||
_lv_memcpy_small(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
|
const lv_ll_node_t * n_act_d = n_act;
|
||||||
}
|
n_act_d += LL_PREV_P_OFFSET(ll_p);
|
||||||
|
return *((lv_ll_node_t **)n_act_d);
|
||||||
return prev;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -393,7 +391,7 @@ bool _lv_ll_is_empty(lv_ll_t * ll_p)
|
|||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the 'pervious node pointer' of a node
|
* Set the previous node pointer of a node
|
||||||
* @param ll_p pointer to linked list
|
* @param ll_p pointer to linked list
|
||||||
* @param act pointer to a node which prev. node pointer should be set
|
* @param act pointer to a node which prev. node pointer should be set
|
||||||
* @param prev pointer to a node which should be the previous node before 'act'
|
* @param prev pointer to a node which should be the previous node before 'act'
|
||||||
@@ -402,11 +400,15 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
|
|||||||
{
|
{
|
||||||
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
|
||||||
|
|
||||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
uint8_t * act8 = (uint8_t *) act;
|
||||||
if(prev)
|
uint8_t * prev8 = (uint8_t *) &prev;
|
||||||
_lv_memcpy_small(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
|
|
||||||
else
|
act8 += LL_PREV_P_OFFSET(ll_p);
|
||||||
_lv_memset_00(act + LL_PREV_P_OFFSET(ll_p), node_p_size);
|
|
||||||
|
uint32_t i;
|
||||||
|
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
||||||
|
act8[i] = prev8[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -418,10 +420,13 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
|
|||||||
static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next)
|
static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next)
|
||||||
{
|
{
|
||||||
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
if(act == NULL) return; /*Can't set the next node of `NULL`*/
|
||||||
|
uint8_t * act8 = (uint8_t *) act;
|
||||||
|
uint8_t * prev8 = (uint8_t *) &next;
|
||||||
|
|
||||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
act8 += LL_NEXT_P_OFFSET(ll_p);
|
||||||
if(next)
|
|
||||||
_lv_memcpy_small(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
|
uint32_t i;
|
||||||
else
|
for(i = 0; i < sizeof(lv_ll_node_t *); i++) {
|
||||||
_lv_memset_00(act + LL_NEXT_P_OFFSET(ll_p), node_p_size);
|
act8[i] = prev8[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user