Skip to content

Commit

Permalink
sflist: SYS_SFLIST_FLAGS_MASK must be a long not an int
Browse files Browse the repository at this point in the history
When splitting the pointer from the flag, ~SYS_SFLIST_FLAGS_MASK remains
a 32-bit value because of the lack of an L qualifier. Let's qualify it
with UL so the top half of 64-bit pointers is not truncated.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
  • Loading branch information
Nicolas Pitre authored and nashif committed Jun 26, 2019
1 parent 549bd60 commit cf5c22d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/misc/sflist.h
Expand Up @@ -200,7 +200,7 @@ static inline void sys_sflist_init(sys_sflist_t *list)
} }


#define SYS_SFLIST_STATIC_INIT(ptr_to_list) {NULL, NULL} #define SYS_SFLIST_STATIC_INIT(ptr_to_list) {NULL, NULL}
#define SYS_SFLIST_FLAGS_MASK 0x3U #define SYS_SFLIST_FLAGS_MASK 0x3UL


static inline sys_sfnode_t *z_sfnode_next_peek(sys_sfnode_t *node) static inline sys_sfnode_t *z_sfnode_next_peek(sys_sfnode_t *node)
{ {
Expand Down Expand Up @@ -281,7 +281,7 @@ static inline u8_t sys_sfnode_flags_get(sys_sfnode_t *node)
*/ */
static inline void sys_sfnode_init(sys_sfnode_t *node, u8_t flags) static inline void sys_sfnode_init(sys_sfnode_t *node, u8_t flags)
{ {
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0U, "flags too large"); __ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0UL, "flags too large");
node->next_and_flags = flags; node->next_and_flags = flags;
} }


Expand All @@ -297,7 +297,7 @@ static inline void sys_sfnode_init(sys_sfnode_t *node, u8_t flags)
*/ */
static inline void sys_sfnode_flags_set(sys_sfnode_t *node, u8_t flags) static inline void sys_sfnode_flags_set(sys_sfnode_t *node, u8_t flags)
{ {
__ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0U, "flags too large"); __ASSERT((flags & ~SYS_SFLIST_FLAGS_MASK) == 0UL, "flags too large");
node->next_and_flags = (unative_t)(z_sfnode_next_peek(node)) | flags; node->next_and_flags = (unative_t)(z_sfnode_next_peek(node)) | flags;
} }


Expand Down

0 comments on commit cf5c22d

Please sign in to comment.