Skip to content

Commit 6dd1a46

Browse files
Nicolas Pitrefabiobaltieri
authored andcommitted
sys: sflist: replace unative_t with uintptr_t
We already have uintptr_t which purpose is exactly what we need here. Signed-off-by: Nicolas Pitre <[email protected]>
1 parent 7b9d4a2 commit 6dd1a46

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

include/zephyr/sys/sflist.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#ifndef ZEPHYR_INCLUDE_SYS_SFLIST_H_
2626
#define ZEPHYR_INCLUDE_SYS_SFLIST_H_
2727

28-
#include <stddef.h>
28+
#include <stdint.h>
2929
#include <stdbool.h>
3030
#include <zephyr/sys/__assert.h>
3131
#include "list_gen.h"
@@ -34,15 +34,9 @@
3434
extern "C" {
3535
#endif
3636

37-
#ifdef __LP64__
38-
typedef uint64_t unative_t;
39-
#else
40-
typedef uint32_t unative_t;
41-
#endif
42-
4337
/** @cond INTERNAL_HIDDEN */
4438
struct _sfnode {
45-
unative_t next_and_flags;
39+
uintptr_t next_and_flags;
4640
};
4741
/** @endcond */
4842

@@ -218,7 +212,8 @@ static inline void sys_sflist_init(sys_sflist_t *list)
218212
* @param ptr_to_list A pointer on the list to initialize
219213
*/
220214
#define SYS_SFLIST_STATIC_INIT(ptr_to_list) {NULL, NULL}
221-
#define SYS_SFLIST_FLAGS_MASK 0x3UL
215+
216+
#define SYS_SFLIST_FLAGS_MASK ((uintptr_t)0x3)
222217

223218
static inline sys_sfnode_t *z_sfnode_next_peek(sys_sfnode_t *node)
224219
{
@@ -232,7 +227,7 @@ static inline void z_sfnode_next_set(sys_sfnode_t *parent,
232227
{
233228
uint8_t cur_flags = sys_sfnode_flags_get(parent);
234229

235-
parent->next_and_flags = cur_flags | (unative_t)child;
230+
parent->next_and_flags = cur_flags | (uintptr_t)child;
236231
}
237232

238233
static inline void z_sflist_head_set(sys_sflist_t *list, sys_sfnode_t *node)
@@ -316,7 +311,7 @@ static inline void sys_sfnode_init(sys_sfnode_t *node, uint8_t flags)
316311
static inline void sys_sfnode_flags_set(sys_sfnode_t *node, uint8_t flags)
317312
{
318313
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0UL, "flags too large");
319-
node->next_and_flags = (unative_t)(z_sfnode_next_peek(node)) | flags;
314+
node->next_and_flags = (uintptr_t)(z_sfnode_next_peek(node)) | flags;
320315
}
321316

322317
/*

0 commit comments

Comments
 (0)